Package org.restlet.ext.jaxrs.internal.util

Examples of org.restlet.ext.jaxrs.internal.util.PathRegExp


            RemainingPath remainingPath) {
        // NICE results may be chached, if any method is returned.
        // The 404 case will be called rarely and produce a lot of cached data.
        final List<ResourceMethod> resourceMethods = new ArrayList<ResourceMethod>();
        for (final ResourceMethod method : this.resourceMethods) {
            final PathRegExp methodPath = method.getPathRegExp();
            if (remainingPath.isEmptyOrSlash()) {
                if (methodPath.isEmptyOrSlash()) {
                    resourceMethods.add(method);
                }
            } else {
                if (methodPath.matchesWithEmpty(remainingPath)) {
                    resourceMethods.add(method);
                }
            }
        }
        return resourceMethods;
View Full Code Here


                    + rootResourceClass.getName()
                    + " has an illegal annotated and typed field: "
                    + e.getMessage());
            return false;
        }
        PathRegExp uriTempl = newRrc.getPathRegExp();
        for (RootResourceClass rrc : this.rootResourceClasses) {
            if (rrc.getJaxRsClass().equals(rootResourceClass)) {
                return true;
            }
            if (rrc.getPathRegExp().equals(uriTempl)) {
                this.logger
                        .warning("There is already a root resource class with path "
                                + uriTempl.getPathTemplateEnc());
                return false;
            }
        }
        rootResourceClasses.add(newRrc);
        return true;
View Full Code Here

            this.logger.warning("Exception while calling bean setters in "
                    + "root resource class " + rootResourceClass.getName()
                    + ": " + e.getMessage());
            return false;
        }
        PathRegExp uriTempl = newRrc.getPathRegExp();
        for (RootResourceClass rrc : this.rootResourceClasses) {
            if (rrc.getJaxRsClass().equals(rootResourceClass)) {
                return true;
            }
            if (rrc.getPathRegExp().equals(uriTempl)) {
                this.logger
                        .warning("There is already a root resource class with path "
                                + uriTempl.getPathTemplateEnc());
                return false;
            }
        }
        rootResourceClasses.add(newRrc);
        return true;
View Full Code Here

        // (a) and (b) and (c) Filter E
        for (RootResourceClass rootResourceClass : this.resourceClasses.roots()) {
            // Map.Entry<UriTemplateRegExp, Class> eAndC = eAndCIter.next();
            // UriTemplateRegExp regExp = eAndC.getKey();
            // Class clazz = eAndC.getValue();
            PathRegExp rrcPathRegExp = rootResourceClass.getPathRegExp();
            MatchingResult matchingResult = rrcPathRegExp.match(u);
            if (matchingResult == null)
                continue; // doesn't match
            if (matchingResult.getFinalCapturingGroup().isEmptyOrSlash())
                eAndCs.add(rootResourceClass);
            else if (rootResourceClass.hasSubResourceMethodsOrLocators())
                eAndCs.add(rootResourceClass);
        }
        // (d)
        if (eAndCs.isEmpty())
            excHandler.rootResourceNotFound();
        // (e) and (f)
        RootResourceClass tClass = getFirstByNoOfLiteralCharsNoOfCapturingGroups(eAndCs);
        // (f)
        PathRegExp rMatch = tClass.getPathRegExp();
        MatchingResult matchResult = rMatch.match(u);
        u = matchResult.getFinalCapturingGroup();
        addPathVarsToMap(matchResult, tlContext.get());
        ResourceObject o = instantiateRrc(tClass);
        return new RroRemPathAndMatchedPath(o, u, matchResult.getMatched());
    }
View Full Code Here

            Collection<ResourceMethodOrLocator> eWithMethod = new ArrayList<ResourceMethodOrLocator>();
            // (c) and (d) Filter E: remove members do not match U or final
            // match not empty
            for (ResourceMethodOrLocator methodOrLocator : resClass
                    .getResourceMethodsAndLocators()) {
                PathRegExp pathRegExp = methodOrLocator.getPathRegExp();
                MatchingResult matchingResult = pathRegExp.match(u);
                if (matchingResult == null)
                    continue;
                if (matchingResult.getFinalCapturingGroup().isEmptyOrSlash())
                    eWithMethod.add(methodOrLocator);
                // the following is added by Stephan (is not in spec 2008-03-06)
                else if (methodOrLocator instanceof SubResourceLocator)
                    eWithMethod.add(methodOrLocator);
            }
            // (e) If E is empty -> HTTP 404
            if (eWithMethod.isEmpty())
                excHandler.resourceNotFound();// NICE (o.getClass(), u);
            // (f) and (g) sort E, use first member of E
            ResourceMethodOrLocator firstMeth = getFirstByNoOfLiteralCharsNoOfCapturingGroups(eWithMethod);

            PathRegExp rMatch = firstMeth.getPathRegExp();
            MatchingResult matchingResult = rMatch.match(u);

            addPathVarsToMap(matchingResult, callContext);

            // (h) When Method is resource method
            if (firstMeth instanceof ResourceMethod)
View Full Code Here

        } catch (AssertionFailedError e) {
            // wonderful
        }
        final RootResourceClass rrc = getPerRequestRootClassWrapper(
                resourceClasses, IllegalPathService2.class);
        PathRegExp rrcRegExp = rrc.getPathRegExp();
        assertEquals("/afsdf:use", rrcRegExp.getPathTemplateDec());
    }
View Full Code Here

TOP

Related Classes of org.restlet.ext.jaxrs.internal.util.PathRegExp

Copyright © 2018 www.massapicom. 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.