protected static List<String> getParameters(String path) {
        List<String> parameters = null;

        int startIndex = path.indexOf('{');
        while (startIndex != -1) {
            int endIndex = path.indexOf('}', startIndex);
            if (endIndex != -1) {
                if (parameters == null) {
                    parameters = new ArrayList<>();
                }
                parameters.add(path.substring(startIndex + 1, endIndex));
                startIndex = path.indexOf('{', endIndex);
            } else {
                // Break out of loop as no valid end token
                startIndex = -1;
            }
        }

        return parameters == null ? Collections.emptyList() : parameters;
    }
@Test
    public void testGetParameters() {
        assertEquals(Arrays.asList("id1", "id2"), RestSpanDecorator.getParameters("/context/{id1}/{id2}"));
    }