Examples of UriTemplateMatcher


Examples of org.apache.wink.common.internal.uritemplate.UriTemplateMatcher

            handleResourceMethod(context, chain);
            return;
        }

        // sub-resource method or locator
        UriTemplateMatcher templateMatcher = resource.getMatcher();
        String tail = UriTemplateProcessor.normalizeUri(templateMatcher.getTail(false));

        // get a sorted set of all the sub-resources (methods and locators)
        List<SubResourceInstance> subResources = resource.getRecord().getMatchingSubResources(tail);
        if (subResources.size() == 0) {
            result.setError(new WebApplicationException(Response.Status.NOT_FOUND));
View Full Code Here

Examples of org.apache.wink.common.internal.uritemplate.UriTemplateMatcher

                                         HandlersChain chain) throws Throwable {
        ResourceRegistry registry = context.getAttribute(ResourceRegistry.class);
        SearchResult result = context.getAttribute(SearchResult.class);
        ResourceInstance resource = result.getResource();
        SubResourceRecord subResourceRecord = subResourceInstance.getRecord();
        UriTemplateMatcher matcher = subResourceInstance.getMatcher();
        String pattern = subResourceRecord.getTemplateProcessor().getPatternString();
        // dispatch to one of the sub-resource methods.
        SubResourceInstance method = null;
        try {
            // if no method is found then a RequestMatchingException exception
View Full Code Here

Examples of org.apache.wink.common.internal.uritemplate.UriTemplateMatcher

                                          List<SubResourceInstance> subResources,
                                          MessageContext context,
                                          HandlersChain chain) throws Throwable {
        ResourceRegistry registry = context.getAttribute(ResourceRegistry.class);
        SearchResult result = context.getAttribute(SearchResult.class);
        UriTemplateMatcher matcher = subResourceInstance.getMatcher();

        // // dispatch to the sub-resource locator.
        // result.setFound(true);
        // result.setMethod(subResourceInstance);
        // // save the matched template variables for UriInfo
View Full Code Here

Examples of org.apache.wink.common.internal.uritemplate.UriTemplateMatcher

        readersLock.lock();
        try {
            // 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()) {
                        found.add(new ResourceInstance(record, matcher));
                    }
                }
            }
        } finally {
View Full Code Here

Examples of org.apache.wink.common.internal.uritemplate.UriTemplateMatcher

                                                             boolean method,
                                                             boolean locator) {
        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

Examples of org.apache.wink.common.internal.uritemplate.UriTemplateMatcher

         * expensive UriTemplateMatcher.matches()
         */
        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;
        }

        readersLock.lock();
        try {

            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

Examples of org.apache.wink.common.internal.uritemplate.UriTemplateMatcher

            handleResourceMethod(context, chain);
            return;
        }

        // sub-resource method or locator
        UriTemplateMatcher templateMatcher = resource.getMatcher();
        String tail = UriTemplateProcessor.normalizeUri(templateMatcher.getTail(false));
        logger.debug("Unmatched tail to the URI: {}", tail);

        // get a sorted list of all the sub-resources (methods and locators)
        List<SubResourceInstance> subResources = resource.getRecord().getMatchingSubResources(tail);
        logger.debug("Possible subresources found: {}", subResources);
View Full Code Here

Examples of org.apache.wink.common.internal.uritemplate.UriTemplateMatcher

                                         HandlersChain chain) throws Throwable {
        ResourceRegistry registry = context.getAttribute(ResourceRegistry.class);
        SearchResult result = context.getAttribute(SearchResult.class);
        ResourceInstance resource = result.getResource();
        SubResourceRecord subResourceRecord = subResourceInstance.getRecord();
        UriTemplateMatcher matcher = subResourceInstance.getMatcher();
        String pattern = subResourceRecord.getTemplateProcessor().getPatternString();
        // dispatch to one of the sub-resource methods.
        SubResourceInstance method = null;
        try {
            // if no method is found then a RequestMatchingException exception
View Full Code Here

Examples of org.apache.wink.common.internal.uritemplate.UriTemplateMatcher

                                          List<SubResourceInstance> subResources,
                                          MessageContext context,
                                          HandlersChain chain) throws Throwable {
        ResourceRegistry registry = context.getAttribute(ResourceRegistry.class);
        SearchResult result = context.getAttribute(SearchResult.class);
        UriTemplateMatcher matcher = subResourceInstance.getMatcher();

        // // dispatch to the sub-resource locator.
        // result.setFound(true);
        // result.setMethod(subResourceInstance);
        // // save the matched template variables for UriInfo
View Full Code Here

Examples of org.apache.wink.common.internal.uritemplate.UriTemplateMatcher

         * expensive UriTemplateMatcher.matches()
         */
        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;
        }

        readersLock.lock();
        try {

            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
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.