Package org.restlet

Examples of org.restlet.Route


                        } else {
                            offsetPath = uriPattern;
                        }

                        // Shift the default route (if any) of the default host
                        Route defaultRoute = component.getDefaultHost()
                                .getDefaultRoute();
                        if (defaultRoute != null) {
                            defaultRoute.getTemplate().setPattern(
                                    offsetPath
                                            + defaultRoute.getTemplate()
                                                    .getPattern());
                            log("[Noelios Restlet Engine] - Attaching restlet: "
                                    + defaultRoute.getNext()
                                    + " to URI: "
                                    + offsetPath
                                    + defaultRoute.getTemplate().getPattern());
                        }

                        // Shift the routes of the default host
                        for (final Route route : component.getDefaultHost()
                                .getRoutes()) {
                            log("[Noelios Restlet Engine] - Attaching restlet: "
                                    + route.getNext()
                                    + " to URI: "
                                    + offsetPath
                                    + route.getTemplate().getPattern());
                            route.getTemplate().setPattern(
                                    offsetPath
                                            + route.getTemplate().getPattern());
                        }
                        for (final VirtualHost virtualHost : component
                                .getHosts()) {
                            // Shift the default route (if any) of the virtual
                            // host
                            defaultRoute = virtualHost.getDefaultRoute();
                            if (defaultRoute != null) {
                                defaultRoute.getTemplate().setPattern(
                                        offsetPath
                                                + defaultRoute.getTemplate()
                                                        .getPattern());
                                log("[Noelios Restlet Engine] - Attaching restlet: "
                                        + defaultRoute.getNext()
                                        + " to URI: "
                                        + offsetPath
                                        + defaultRoute.getTemplate()
                                                .getPattern());
                            }
                            // Shift the routes of the virtual host
                            for (final Route route : virtualHost.getRoutes()) {
                                log("[Noelios Restlet Engine] - Attaching restlet: "
View Full Code Here


            public void handle(Request request, Response response) {
                response.setStatus(Status.CLIENT_ERROR_NOT_FOUND,
                        "No virtual host could handle the request");
            }
        };
        setDefaultRoute(new Route(this, "", noHostMatched));

        // Start the router
        super.start();
    }
View Full Code Here

                        } else {
                            offsetPath = uriPattern;
                        }

                        // Shift the default route (if any) of the default host
                        Route defaultRoute = component.getDefaultHost()
                                .getDefaultRoute();
                        if (defaultRoute != null) {
                            defaultRoute.getTemplate().setPattern(
                                    offsetPath
                                            + defaultRoute.getTemplate()
                                                    .getPattern());
                            log("[Noelios Restlet Engine] - Attaching restlet: "
                                    + defaultRoute.getNext()
                                    + " to URI: "
                                    + offsetPath
                                    + defaultRoute.getTemplate().getPattern());
                        }

                        // Shift the routes of the default host
                        for (final Route route : component.getDefaultHost()
                                .getRoutes()) {
                            log("[Noelios Restlet Engine] - Attaching restlet: "
                                    + route.getNext()
                                    + " to URI: "
                                    + offsetPath
                                    + route.getTemplate().getPattern());
                            route.getTemplate().setPattern(
                                    offsetPath
                                            + route.getTemplate().getPattern());
                        }
                        for (final VirtualHost virtualHost : component
                                .getHosts()) {
                            // Shift the default route (if any) of the virtual
                            // host
                            defaultRoute = virtualHost.getDefaultRoute();
                            if (defaultRoute != null) {
                                defaultRoute.getTemplate().setPattern(
                                        offsetPath
                                                + defaultRoute.getTemplate()
                                                        .getPattern());
                                log("[Noelios Restlet Engine] - Attaching restlet: "
                                        + defaultRoute.getNext()
                                        + " to URI: "
                                        + offsetPath
                                        + defaultRoute.getTemplate()
                                                .getPattern());
                            }
                            // Shift the routes of the virtual host
                            for (final Route route : virtualHost.getRoutes()) {
                                log("[Noelios Restlet Engine] - Attaching restlet: "
View Full Code Here

            List l = new ArrayList();

            Iterator it = myRouter.getRoutes().iterator();

            while (it.hasNext()) {
                Route r = (Route) it.next();
                String pattern = r.getTemplate().getPattern();

                if (!pattern.contains("{") && (pattern.length() > 1)) {
                    l.add(pattern.substring(1)); // trim leading slash
                }
            }
View Full Code Here

            List l = new ArrayList();

            Iterator it = myRouter.getRoutes().iterator();

            while (it.hasNext()) {
                Route r = (Route) it.next();
                String pattern = r.getTemplate().getPattern();

                if (!pattern.contains("{") && (pattern.length() > 1)) {
                    l.add(pattern.substring(1)); // trim leading slash
                }
            }
View Full Code Here

    }

    public Route attach(String uriPattern, Class targetClass, Map props) {
        //
        // call super and store route
        Route route = super.attach(uriPattern, targetClass);
        //
        // map route with props
        routeProps.put(route,props);
        //
        // return route
View Full Code Here

    if (logger.isDebugEnabled()) {
      logger.debug("Attaching Restlet of class '{}' to URI='{}' (strict='{}')", target.getClass().getName(), uriPattern,
          strict);
    }

    Route route = router.attach(uriPattern, target);

    if (strict) {
      route.getTemplate().setMatchingMode(Template.MODE_EQUALS);
    } else {
      route.getTemplate().setMatchingMode(Template.MODE_STARTS_WITH);
    }
  }
View Full Code Here

            public void handle(Request request, Response response) {
                response.setStatus(Status.CLIENT_ERROR_NOT_FOUND,
                        "No virtual host could handle the request");
            }
        };
        setDefaultRoute(new Route(this, "", noHostMatched));

        // Start the router
        super.start();
    }
View Full Code Here

                response.setStatus(Status.CLIENT_ERROR_NOT_FOUND,
                        "No virtual host could handle the request");
            }
        };

        setDefaultRoute(new Route(this, "", noHostMatched));

        // Start the router
        super.start();
    }
View Full Code Here

            public void handle(Request request, Response response) {
                response.setStatus(Status.CLIENT_ERROR_NOT_FOUND,
                        "No virtual host could handle the request");
            }
        };
        setDefaultRoute(new Route(this, "", noHostMatched));

        // Start the router
        super.start();
    }
View Full Code Here

TOP

Related Classes of org.restlet.Route

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.