Package org.restlet

Examples of org.restlet.Restlet


    }

    public Restlet getNext(Request request, Response response) {
        //
        // call super and store restlet (route)
        Restlet restlet = super.getNext(request, response);
        //
        // check if thre request route is founded
        if (restlet != null) {
            //
            // find props for this route
View Full Code Here


    public void init() throws ServletException {
        super.init();
        log.debug(".init() - start");
        this.converter = new ServletConverter(getServletContext());

        Restlet restlet = new Restlet() {
            public void handle(Request req, Response res) {
                String name = (String) req.getAttributes().get("name");
                String msg = null;
                if (name != null)
                    msg = "Hello World "+name+"!";
View Full Code Here

    public RestletConsumer(Endpoint endpoint, Processor processor)
        throws Exception {
        super(endpoint, processor);
       
        restlet = new Restlet() {
            @Override
            public void handle(Request request, Response response) {
                if (LOG.isDebugEnabled()) {
                    LOG.debug("Consumer restlet handle request method: " + request.getMethod());
                }
View Full Code Here

        if (LOG.isDebugEnabled()) {
            LOG.debug("MethodRouter (" + uriPattern + ") received request method: "
                    + request.getMethod());
        }
       
        Restlet target = routes.get(request.getMethod());
        if (target != null) {
            target.handle(request, response);
        } else {
            if (LOG.isDebugEnabled()) {
                LOG.debug("No route for request method: " + request.getMethod());
            }
            response.setStatus(Status.CLIENT_ERROR_NOT_FOUND);
View Full Code Here

    router.attach("/clusters/{clusterName}/constraints/{constraintType}/{constraintId}",
        ConstraintResource.class);
    router.attach("/zkPath", ZkPathResource.class).setMatchingMode(Template.MODE_STARTS_WITH);
    router.attach("/zkChild", ZkChildResource.class).setMatchingMode(Template.MODE_STARTS_WITH);

    Restlet mainpage = new Restlet() {
      @Override
      public void handle(Request request, Response response) {
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append("<html>");
        stringBuilder.append("<head><title>Restlet Cluster Management page</title></head>");
View Full Code Here

        final String target = "http://localhost:" + (TEST_PORT + 1) + "{rr}";
        final Redirector proxy = new Redirector(proxyComponent.getContext()
                .createChildContext(), target, Redirector.MODE_SERVER_OUTBOUND);

        // Create a new Restlet that will display some path information.
        final Restlet trace = new Restlet(originComponent.getContext()
                .createChildContext()) {
            @Override
            public void handle(Request request, Response response) {
                // Print the requested URI path
                final String message = "Resource URI:  "
View Full Code Here

                        route = router.attach(uriPattern, resourceClass);
                    } else {
                        route = router.attachDefault(resourceClass);
                    }
                } else {
                    Restlet target = null;

                    try {
                        // Create a new instance of the application class by
                        // invoking the constructor with the Context parameter.
                        target = (Restlet) targetClass.getConstructor(
                                Context.class).newInstance(
                                getComponent().getContext()
                                        .createChildContext());
                    } catch (NoSuchMethodException e) {
                        getLogger()
                                .log(Level.FINE,
                                        "Couldn't invoke the constructor of the target class. Please check this class has a constructor with a single parameter of type Context. The empty constructor and the context setter will be used instead: "
                                                + targetClassName, e);

                        // The constructor with the Context parameter does not
                        // exist. Instantiate an application with the default
                        // constructor then invoke the setContext method.
                        target = (Restlet) targetClass.getConstructor()
                                .newInstance();
                        target.setContext(getComponent().getContext()
                                .createChildContext());
                    }

                    if (target != null) {
                        if ((uriPattern != null) && !defaultRoute) {
View Full Code Here

        // Attach the Application's server root Restlet
        setInboundNext(getHelped().getInboundRoot());

        if (getOutboundNext() == null) {
            // Warn about chaining problem
            setOutboundNext(new Restlet() {
                @Override
                public void handle(Request request, Response response) {
                    response.setStatus(Status.SERVER_ERROR_INTERNAL,
                            "The server isn't properly configured to handle client calls.");
                    getLogger()
View Full Code Here

     *
     * @param filter
     *            The inbound filter to add.
     */
    protected synchronized void addInboundFilter(Filter filter) {
        Restlet next = getInboundNext();

        if (getFirstInboundFilter() == null) {
            setFirstInboundFilter(filter);
        } else if (getLastInboundFilter() != null) {
            getLastInboundFilter().setNext(filter);
View Full Code Here

     *
     * @param filter
     *            The outbound filter to add.
     */
    protected synchronized void addOutboundFilter(Filter filter) {
        Restlet next = getOutboundNext();

        if (getFirstOutboundFilter() == null) {
            setFirstOutboundFilter(filter);
        } else if (getLastOutboundFilter() != null) {
            getLastOutboundFilter().setNext(filter);
View Full Code Here

TOP

Related Classes of org.restlet.Restlet

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.