Package org.apache.wink.common.internal.uritemplate

Examples of org.apache.wink.common.internal.uritemplate.UriTemplateMatcher.matches()


            JaxRsUriTemplateProcessor.newNormalizedInstance("/path1/path2/./../path3");
        assertEquals("path1/path3", processor.getTemplate());

        processor = (JaxRsUriTemplateProcessor)JaxRsUriTemplateProcessor.newNormalizedInstance("");
        UriTemplateMatcher matcher = processor.matcher();
        boolean matches = matcher.matches("");
        assertTrue(matches);
        assertTrue(matcher.isExactMatch());

        processor = (JaxRsUriTemplateProcessor)JaxRsUriTemplateProcessor.newNormalizedInstance("/");
        matcher = processor.matcher();
View Full Code Here


        assertTrue(matches);
        assertTrue(matcher.isExactMatch());

        processor = (JaxRsUriTemplateProcessor)JaxRsUriTemplateProcessor.newNormalizedInstance("/");
        matcher = processor.matcher();
        matches = matcher.matches("");
        assertTrue(matches);
        assertTrue(matcher.isExactMatch());

    }
View Full Code Here

        }

        // compiled but not matched
        processor.compile("/path1/{var1}");
        UriTemplateMatcher matcher = processor.matcher();
        assertFalse(matcher.matches("/path2"));

        try {
            matcher.getVariables(false);
            fail("expected IllegalStateException to be thrown");
        } catch (IllegalStateException e) {
View Full Code Here

         */
        previousMatched = uriToResourceCache.get(isContinuedSearchPolicy).get(uri);
        if (previousMatched != null) {
            for (ResourceRecord record : previousMatched) {
                UriTemplateMatcher matcher = record.getTemplateProcessor().matcher();
                if (matcher.matches(uri)) {
                    found.add(new ResourceInstance(record, matcher));
                }
            }
            return found;
        }
View Full Code Here

            previousMatched = new ArrayList<ResourceRecord>();

            // the list of root resource records is already sorted
            for (ResourceRecord record : rootResources) {
                UriTemplateMatcher matcher = record.getTemplateProcessor().matcher();
                if (matcher.matches(uri)) {
                    if (matcher.isExactMatch() || record.hasSubResources()) {
                        previousMatched.add(record);
                        found.add(new ResourceInstance(record, matcher));
                        if (!isContinuedSearchPolicy) {
                            break;
View Full Code Here

        List<SubResourceInstance> list = new LinkedList<SubResourceInstance>();
        // add records according to the request uri
        for (SubResourceRecord record : subResources) {
            UriTemplateMatcher matcher = record.getTemplateProcessor().matcher();
            // if the uri is a match to the uri template
            if (matcher.matches(uri)) {
                if (method && record instanceof SubResourceMethodRecord && matcher.isExactMatch()) {
                    list.add(new SubResourceInstance(record, matcher));
                }
                if (locator && record instanceof SubResourceLocatorRecord) {
                    list.add(new SubResourceInstance(record, matcher));
View Full Code Here

    public void testHead() {
        JaxRsUriTemplateProcessor processor =
            new JaxRsUriTemplateProcessor("/path1/{var1}/path2{var2:[ab]*}/{var3}");
        UriTemplateMatcher matcher = processor.matcher();
        matcher.matches("/path1/value%20a/path2abab/valueB/tail%20part");

        String head = matcher.getHead();
        assertEquals("/path1/value a/path2abab/valueB", head);
        assertEquals("/path1/value%20a/path2abab/valueB", matcher.getHead(false));

View Full Code Here

        String head = matcher.getHead();
        assertEquals("/path1/value a/path2abab/valueB", head);
        assertEquals("/path1/value%20a/path2abab/valueB", matcher.getHead(false));

        matcher.matches("/path1/value%20a/path2abab/valueB/");
        head = matcher.getHead();
        assertEquals("/path1/value a/path2abab/valueB", head);

        matcher.matches("/path1/value%20a/path2abab/valueB");
        head = matcher.getHead();
View Full Code Here

        matcher.matches("/path1/value%20a/path2abab/valueB/");
        head = matcher.getHead();
        assertEquals("/path1/value a/path2abab/valueB", head);

        matcher.matches("/path1/value%20a/path2abab/valueB");
        head = matcher.getHead();
        assertEquals("/path1/value a/path2abab/valueB", head);
    }

    public void testSameVariableTwice() {
View Full Code Here

    public void testSameVariableTwice() {
        JaxRsUriTemplateProcessor processor =
            new JaxRsUriTemplateProcessor("/path1/{var1}/path2{var1:[ab]*}/tail");
        UriTemplateMatcher matcher = processor.matcher();
        boolean matches = matcher.matches("/path1/value%20a/path2abab/tail");
        assertTrue(matches);
        assertEquals("value a", matcher.getVariableValue("var1"));
        assertEquals("value%20a", matcher.getVariableValue("var1", false));

        List<String> varValues = matcher.getVariableValues("var1");
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.