Examples of PathTemplate


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

    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;
View Full Code Here

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

    }

    private PathPattern getPattern(String path, Class c) {
        PathPattern p = null;
        try {
            p = new PathPattern(new PathTemplate(path));
        } catch (IllegalArgumentException ex) {
            Errors.error("Illegal URI template for root resource class " + c.getName() +
                    ": "+ ex.getMessage());
        }
        return p;
View Full Code Here

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

            final AbstractResource resource,
            final RulesMap<UriRule> rulesMap) {
        for (final AbstractSubResourceLocator locator : resource.getSubResourceLocators()) {
            PathPattern p = null;
            try {
                p = new PathPattern(new PathTemplate(locator.getPath().getValue()));
            } catch (IllegalArgumentException ex) {
                Errors.error(String.format("Illegal URI template for sub-resource locator %s: %s",
                        locator.getMethod(), ex.getMessage()));
                continue;
            }
View Full Code Here

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

        for (final AbstractSubResourceMethod method : resource.getSubResourceMethods()) {

            PathPattern p;
            try {
                p = new PathPattern(new PathTemplate(method.getPath().getValue()), "(/)?");
            } catch (IllegalArgumentException ex) {
                Errors.error(String.format("Illegal URI template for sub-resource method %s: %s",
                        method.getMethod(), ex.getMessage()));
                continue;
            }
View Full Code Here

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

        routes = routeMap.values().toArray(new RouteEntry[routeMap.size()]);
    }

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

            }

            ComponentInjector ci = new ComponentInjector(injectableFactory, o.getClass());
            ci.inject(o);

            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 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)));
        }

        createWadlResource(rootResources, rulesMap, wadlFactory);
View Full Code Here

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

            return;
        }

        // 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,
View Full Code Here

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

    private void processSubResourceLocators(
            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(),
                    injectableContext.getInjectable(locator.getParameters(), ComponentScope.PerRequest),
                    ff.getRequestFilters(resourceFilters),
                    ff.getResponseFilters(resourceFilters));

            rulesMap.put(p,
                    new RightHandPathRule(
                    config.getFeature(ResourceConfig.FEATURE_REDIRECT),
                    t.endsWithSlash(),
                    r));
        }
    }
View Full Code Here

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

            FilterFactory ff) {
        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.PathTemplate

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