Package org.restlet

Examples of org.restlet.Router


  }
 
  @Override
  public Restlet createRoot()
  {
    Router router = new Router(getContext());
    router.setDefaultMatchingMode(Template.MODE_EQUALS);
    router.attach("/clusters", ClustersResource.class);
    router.attach("/clusters/{clusterName}", ClusterResource.class);
    router.attach("/clusters/{clusterName}/resourceGroups", ResourceGroupsResource.class);
    router.attach("/clusters/{clusterName}/resourceGroups/{resourceName}", ResourceGroupResource.class);
    router.attach("/clusters/{clusterName}/instances", InstancesResource.class);
    router.attach("/clusters/{clusterName}/instances/{instanceName}", InstanceResource.class);
    router.attach("/clusters/{clusterName}/instances/{instanceName}/currentState/{resourceName}", CurrentStateResource.class);
    router.attach("/clusters/{clusterName}/instances/{instanceName}/statusUpdate/{resourceName}", StatusUpdateResource.class);
    router.attach("/clusters/{clusterName}/instances/{instanceName}/errors/{resourceName}", ErrorResource.class);
    router.attach("/clusters/{clusterName}/instances/{instanceName}/currentState", CurrentStatesResource.class);
    router.attach("/clusters/{clusterName}/instances/{instanceName}/statusUpdate", StatusUpdatesResource.class);
    router.attach("/clusters/{clusterName}/instances/{instanceName}/errors", ErrorsResource.class);
    router.attach("/clusters/{clusterName}/resourceGroups/{resourceName}/idealState", IdealStateResource.class);
    router.attach("/clusters/{clusterName}/resourceGroups/{resourceName}/externalView", ExternalViewResource.class);
    router.attach("/clusters/{clusterName}/StateModelDefs/{modelName}", StateModelResource.class);
    router.attach("/clusters/{clusterName}/StateModelDefs", StateModelsResource.class);
    router.attach("/clusters/{clusterName}/SchedulerTasks", SchedulerTasksResource.class);
    router.attach("/clusters/{clusterName}/Controller", ControllerResource.class);
    router.attach("/clusters/{clusterName}/Controller/statusUpdates/{MessageType}/{MessageId}", ControllerStatusUpdateResource.class);
    router.attach("/clusters/{clusterName}/configs", ConfigResource.class);
    router.attach("/clusters/{clusterName}/configs/{scope}", ConfigResource.class);
    router.attach("/clusters/{clusterName}/configs/{scope}/{scopeKey1}", ConfigResource.class);
    router.attach("/clusters/{clusterName}/configs/{scope}/{scopeKey1}/{scopeKey2}", ConfigResource.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>");
        stringBuilder.append("<body bgcolor=white>");
        stringBuilder.append("<table border=\"0\">");
        stringBuilder.append("<tr>");
        stringBuilder.append("<td>");
        stringBuilder.append("<h1>Rest cluster management interface V1</h1>");
        stringBuilder.append("</td>");
        stringBuilder.append("</tr>");
        stringBuilder.append("</table>");
        stringBuilder.append("</body>");
        stringBuilder.append("</html>");
        response.setEntity(new StringRepresentation(stringBuilder.toString(),
            MediaType.TEXT_HTML));
      }
    };
    router.attach("", mainpage);
    return router;
  }
View Full Code Here


  }
 
  @Override
  public Restlet createRoot()
  {
    Router router = new Router(getContext());
    router.attach("/" + ZKPropertyTransferServer.RESTRESOURCENAME, ZNRecordUpdateResource.class);
    return router;
  }
View Full Code Here

  }
  @Override
  public Restlet createRoot()
  {
  Router router = new Router(_context);

    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>");
        stringBuilder.append("<body bgcolor=white>");
        stringBuilder.append("<table border=\"0\">");
        stringBuilder.append("<tr>");
        stringBuilder.append("<td>");
        stringBuilder.append("<h1>Rest cluster management interface V1</h1>");
        stringBuilder.append("</td>");
        stringBuilder.append("</tr>");
        stringBuilder.append("</table>");
        stringBuilder.append("</body>");
        stringBuilder.append("</html>");
        response.setEntity(new StringRepresentation(stringBuilder.toString(),
            MediaType.TEXT_HTML));
      }
    };
   
    if (_mockNode == null) {
      logger.debug("_mockNode in createRoot is null");
    }
    router.attach("", mainpage);
   
    //Espresso handlers
    router.attach("/{"+DATABASENAME+"}/{"+TABLENAME+"}/{"+RESOURCENAME+"}", EspressoResource.class);
    router.attach("/{"+DATABASENAME+"}/{"+TABLENAME+"}/{"+RESOURCENAME+"}/{"+SUBRESOURCENAME+"}", EspressoResource.class);
   
    //Admin handlers
    router.attach("/{"+STOPSERVICECOMMAND+"}", StopServiceResource.class);
   
    return router;
  }
View Full Code Here

        }
    }

    public Restlet createRoot() {
        if (myRouter == null){
            myRouter = new Router();

            Iterator i =
                GeoServerExtensions.extensions(RESTMapping.class).iterator();

            while (i.hasNext()){
View Full Code Here

        System.out.println(message);
        response.getOutputStream().write(message.getBytes());
    }

    public Restlet createRoot() {
        Router router = new Router();

        SpringContext springContext = new SpringContext(getContext());

        springContext.getXmlConfigRefs().add("war://WEB-INF/classes/applicationContext.xml");
        //       router.setRequiredScore(0);
        //       router.attach("/roles", new UserRestlet("Role Management Page"));
        router.attach("/user/{name}", new UserRestlet(null));
        router.attach("/dummy", new DummyRestlet(springContext));

        //       router.attach("/geoserver/users/{user}/roles", new UserRestlet("getting role information"));
        return router;
    }
View Full Code Here

    /**
     * Create the Restlet that will handle the requests after they are translated.
     * @return the Restlet to handle requests
     */
    public Restlet createRoot() {
        Router router = new Router();

        EditableUserDAO eud = (EditableUserDAO) getApplicationContext()
                                                    .getBean("userDetailsService");
        // router.attach("/roles", new UserRestlet("Role Management Page"));
        router.attach("/user.{type}", new UserFinder(router.getContext(), eud));
        router.attach("/user", new UserFinder(router.getContext(), eud));
        router.attach("/user/{name}.{type}", new UserFinder(router.getContext(), eud));
        router.attach("/user/{name}", new UserFinder(router.getContext(), eud));
        router.attach("/dummy/{name}", new DummyRestlet(getApplicationContext()));

        // router.attach("/geoserver/users/{user}/roles", new
        // UserRestlet("getting role information"));
        return router;
    }
View Full Code Here

        }
    }

    public Restlet createRoot() {
        if (myRouter == null){
            myRouter = new Router() {
                @Override
                protected synchronized void init(Request request,
                        Response response) {
                    super.init(request, response);
View Full Code Here

                res.setEntity(msg, MediaType.TEXT_PLAIN);
            }
        };


        Router router = new Router(this.converter.getContext());
        router.attach("/hello/{name}",restlet);
        router.attach("/hello/",restlet);
        /*Restlet trace = new Restlet(this.converter.getContext()) {
            public void handle(Request req, Response res) {
                log.info("Hello World");
                res.setEntity("Hello World!", MediaType.TEXT_PLAIN);
            }
View Full Code Here

        getContext().getAttributes().put("serverProvider", serverConnectionProvider);
       
        final Directory jsDirectory = new Directory(getContext(),
                "clap://class/jminix/js");
       
        Router router = new Router(getContext());
             
        router.attach("/js", jsDirectory);
        router.attach("/servers/",ServersResource.class);
        router.attach("/servers/{server}", ServerResource.class);
        router.attach("/servers/{server}/domains", DomainsResource.class);         
        router.attach("/servers/{server}/domains/{domain}", DomainResource.class);
        router.attach("/servers/{server}/domains/{domain}/mbeans", MBeansResource.class);
        router.attach("/servers/{server}/domains/{domain}/mbeans/{mbean}", MBeanResource.class);
        router.attach("/servers/{server}/domains/{domain}/mbeans/{mbean}/attributes", AttributesResource.class);
        router.attach("/servers/{server}/domains/{domain}/mbeans/{mbean}/attributes/{attribute}", AttributeResource.class);
        router.attach("/servers/{server}/domains/{domain}/mbeans/{mbean}/operations", OperationsResource.class);
        router.attach("/servers/{server}/domains/{domain}/mbeans/{mbean}/operations/{operation}", OperationResource.class);       
       
        // Very ugly way to provide the index.html in a reliable way... I did not figure how to do
        // it properly.
        router.attach("/", new Restlet() {

            @Override
            public void handle(Request request, Response response)
            {
                response.setEntity(new StreamRepresentation(MediaType.TEXT_HTML) {
View Full Code Here

   * {@inheritDoc}
   */
  @Override
  public synchronized Restlet createRoot() {
    // Create a root router
    Router router = new Router(getContext());

    // Create a RESTlet handler with working attributes list
    List<String> workingAttributeList = new ArrayList<String>();
    workingAttributeList.add("user");
    workingAttributeList.add("action");
    RestletOne restletOne = new RestletOne(workingAttributeList);

    // Attach the handler to the root router
    router.attach("/", restletOne);
    router.attach("/users", restletOne);
    router.attach("/users/{user}", restletOne);
    router.attach("/users/{user}/actions", restletOne);
    router.attach("/users/{user}/actions/{action}", restletOne);

    // Return the root router
    return router;
  }
View Full Code Here

TOP

Related Classes of org.restlet.Router

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.