Package org.restlet.routing

Examples of org.restlet.routing.Redirector


    String restapihost = getContext().getParameters().getFirstValue("restapi.host","localhost");
    String restapiport = getContext().getParameters().getFirstValue("restapi.port","8111");
       
    String target = "http://"+restapihost+":"+restapiport+"/v1{rr}";
    router.setDefaultMatchingMode(Template.MODE_STARTS_WITH);
    Redirector redirector = new Redirector(getContext(),target, Redirector.MODE_SERVER_OUTBOUND);
    router.attach("/v1", redirector);
    router.attach("/", new Directory(getContext(), "war:///"));
    return  router;
  };
View Full Code Here


 
  public void createRedirector(String ip)
  {       
    System.out.println("creating redirector: "+ ip);
    String target = "http://"+ip+"8111/v1{rr}";   
    Redirector redirector = new Redirector(getContext(),target, Redirector.MODE_SERVER_OUTBOUND);
//    router.attach("/v1", redirector);
    ((Router)getInboundRoot()).attach("/v1", redirector);
    System.out.println("Finishing redirector");
  }
View Full Code Here


    // *** Static files ***
    // USING FILE
    String target = "index.html";
    Redirector redirector = new Redirector(getContext(), target, Redirector.MODE_CLIENT_FOUND);
    router.attach("/", redirector);
    File currentPath = new File(RestServer.class.getProtectionDomain().getCodeSource().getLocation().getPath());
    String htmlPath = "file:///" + currentPath.getParent() + "/html/";
    router.attach("/", redirector);
    router.attach("", new Directory(getContext(), htmlPath));
View Full Code Here

TOP

Related Classes of org.restlet.routing.Redirector

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.