Examples of PathPattern


Examples of com.sun.jersey.server.impl.uri.PathPattern

    }

    private RouteEntry createRoute(RouteDefinitionEntry definition) {
        RouteEntry route = new RouteEntry();
        final PathTemplate template = new PathTemplate(definition.getPath());
        route.pattern = new PathPattern(template, definition.getPath().equals("") ? "/" : "");
        return route;
    }
View Full Code Here

Examples of com.sun.jersey.server.impl.uri.PathPattern

            ensureTemplateUnused(t, ar, uriTemplatesUsed);

            ResourceClass r = getResourceClass(ar);
            rootResources.add(r.resource);

            PathPattern p = new PathPattern(t);

            rulesMap.put(p, new RightHandPathRule(
                        resourceConfig.getFeature(ResourceConfig.FEATURE_REDIRECT),
                        t.endsWithSlash(),
                        new ResourceObjectRule(t, o)));
        }
       
        for (Class<?> c : classes) {
            AbstractResource ar = getAbstractResource(c);
            if (!ar.isRootResource()) {
                LOGGER.warning("The class, " + c + ", registered as a root resource class " +
                        "of the ResourceConfig is not a root resource class" +
                        ". This class will be ignored");
                continue;
            }
            // TODO this should be moved to the validation
            // as such classes are not root resource classes
            int modifiers = c.getModifiers();
            if (Modifier.isAbstract(modifiers) && !Modifier.isInterface(modifiers)) {
                LOGGER.warning("The " + c + ", registered as a root resource class " +
                        "of the ResourceConfig cannot be instantiated" +
                        ". This class will be ignored");
                continue;
            } else if (Modifier.isInterface(modifiers)) {
                LOGGER.warning("The " + c + ", registered as a root resource class " +
                        "of the ResourceConfig cannot be instantiated" +
                        ". This interface will be ignored");
                continue;
            }

            UriTemplate t = new PathTemplate(ar.getPath().getValue());
            ensureTemplateUnused(t, ar, uriTemplatesUsed);

            ResourceClass r = getResourceClass(ar);
            rootResources.add(r.resource);

            PathPattern p = new PathPattern(t);

            rulesMap.put(p, new RightHandPathRule(
                    resourceConfig.getFeature(ResourceConfig.FEATURE_REDIRECT),
                    t.endsWithSlash(),
                    new ResourceClassRule(t, c)));
View Full Code Here

Examples of com.sun.jersey.server.impl.uri.PathPattern

        }

        // Preload wadl resource runtime meta data
        getResourceClass(WadlResource.class);
        UriTemplate t = new PathTemplate("application.wadl");
        PathPattern p = new PathPattern(t);

        rulesMap.put(p, new RightHandPathRule(
                resourceConfig.getFeature(ResourceConfig.FEATURE_REDIRECT),
                false,
                new ResourceObjectRule(t, wr)));
View Full Code Here

Examples of com.sun.jersey.server.impl.uri.PathPattern

     */
    private TrieNode<R> initTrie(List<PatternRulePair<R>> rules) {
        TrieNode<R> a = new TrieNode<R>();
        for (PatternRulePair<R> prp : rules) {
            if (prp.p instanceof PathPattern) {
                PathPattern p = (PathPattern)prp.p;           
                a.add(p.getTemplate().getTemplate(), prp.r, prp.p);
            } else {
                throw new IllegalArgumentException(
                        "The automata matching algorithm currently only works" +
                        "for UriPattern instance that are instances of " +
                        "PathPattern");
View Full Code Here

Examples of com.sun.jersey.server.impl.uri.PathPattern

        final ResourceMethodMap methodMap = processMethods(implictProduces, df, ff);

        // Create the rules for the sub-resource HTTP methods
        for (Map.Entry<PathPattern, ResourceMethodMap> e : patternMethodMap.entrySet()) {
            final PathPattern p = e.getKey();
            final ResourceMethodMap rmm = e.getValue();
           
            rmm.sort();
            rulesMap.put(p,
                    new RightHandPathRule(
                    config.getFeature(ResourceConfig.FEATURE_REDIRECT),                   
                    p.getTemplate().endsWithSlash(),
                    new HttpMethodRule(rmm, implictProduces, true)));
        }

        // Create the rules for the HTTP methods
        methodMap.sort();
View Full Code Here

Examples of com.sun.jersey.server.impl.uri.PathPattern

            FilterFactory ff,
            ServerInjectableProviderContext injectableContext,
            RulesMap<UriRule> rulesMap) {
        for (final AbstractSubResourceLocator locator : resource.getSubResourceLocators()) {
            UriTemplate t = new PathTemplate(locator.getPath().getValue());
            PathPattern p = new PathPattern(t);

            List<ResourceFilter> resourceFilters = ff.getResourceFilters(locator);
            UriRule r = new SubLocatorRule(
                    t,
                    locator.getMethod(),
View Full Code Here

Examples of com.sun.jersey.server.impl.uri.PathPattern

        final Map<PathPattern, ResourceMethodMap> patternMethodMap =
                new HashMap<PathPattern, ResourceMethodMap>();
        for (final AbstractSubResourceMethod method : this.resource.getSubResourceMethods()) {

            UriTemplate t = new PathTemplate(method.getPath().getValue());
            PathPattern p = new PathPattern(t, "(/)?");

            ResourceMethod rm = new ResourceHttpMethod(df, ff, t, method);
            addToPatternMethodMap(patternMethodMap, p, rm);
        }
View Full Code Here

Examples of com.sun.jersey.server.impl.uri.PathPattern

    private void initWadlResource() {
        if (!wadlFactory.isSupported())
            return;

        final PathPattern p = new PathPattern(new PathTemplate("application.wadl"));

        // If "application.wadl" is already defined to not add the
        // default WADL resource
        if (rules.containsKey(p))
            return;

        // Configure meta-data
        wa.initiateResource(WadlResource.class);

        rules.put(p, new RightHandPathRule(
                resourceConfig.getFeature(ResourceConfig.FEATURE_REDIRECT),
                p.getTemplate().endsWithSlash(),
                new ResourceClassRule(p.getTemplate(), WadlResource.class)));
    }
View Full Code Here

Examples of com.sun.jersey.server.impl.uri.PathPattern

                p.getTemplate().endsWithSlash(),
                new ResourceClassRule(p.getTemplate(), WadlResource.class)));
    }

    private void addRule(final String path, final Class c) {
        final PathPattern p = getPattern(path, c);
        if (isPatternValid(p, c)) {
            rules.put(p, new RightHandPathRule(
                        resourceConfig.getFeature(ResourceConfig.FEATURE_REDIRECT),
                        p.getTemplate().endsWithSlash(),
                        new ResourceClassRule(p.getTemplate(), c)));
        }
    }
View Full Code Here

Examples of com.sun.jersey.server.impl.uri.PathPattern

                        new ResourceClassRule(p.getTemplate(), c)));
        }
    }

    private void addRule(final String path, final Object o) {
        final PathPattern p = getPattern(path, o.getClass());
        if (isPatternValid(p, o.getClass())) {
            rules.put(p, new RightHandPathRule(
                        resourceConfig.getFeature(ResourceConfig.FEATURE_REDIRECT),
                        p.getTemplate().endsWithSlash(),
                        new ResourceObjectRule(p.getTemplate(), o)));
        }
    }
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.