Package org.restlet.resource

Examples of org.restlet.resource.Directory


            final String indexName = contentConf.getAttributeValue("index");
            // hope the directory resource can handle it
            LOG.fine("  Content directory: "+source);
            Application app = new Application(parentContext) {
               public Restlet createRoot() {
                  Directory directory = new Directory(getContext(),uri);
                  directory.setIndexName(indexName==null ? "index.html" : indexName);
                  return directory;
               }
            };
            return app;
         }
View Full Code Here


        ChallengeAuthenticator authenticator = new ChallengeAuthenticator(
                getContext(), ChallengeScheme.HTTP_BASIC, "Tutorial");
        authenticator.setVerifier(verifier);

        // Create a Directory able to return a deep hierarchy of files
        Directory directory = new Directory(getContext(), ROOT_URI);
        directory.setListingAllowed(true);
        authenticator.setNext(directory);
        return authenticator;
    }
View Full Code Here

                if (applicationInfo != null) {
                    ((WadlServerResource) resource).describe(applicationInfo);
                }
            }
        } else if (resource instanceof Directory) {
            Directory directory = (Directory) resource;
            methodsList.add(Method.GET);

            if (directory.isModifiable()) {
                methodsList.add(Method.DELETE);
                methodsList.add(Method.PUT);
            }
        }
View Full Code Here

            } else {
               // hope the directory resource can handle it
               getLogger().info("  Directory: "+content.getSource()+" at "+content.getMatch());
               Application app = new Application(context) {
                  public Restlet createRoot() {
                     Directory directory = new Directory(getContext(),uri);
                     directory.setIndexName("index.html");
                     return directory;
                  }
               };
               router.attach(content.getMatch(),app);
            }
View Full Code Here

        String target = "http://" + restapihost + ":" + restapiport + "/v2{rr}";
        router.setDefaultMatchingMode(Template.MODE_STARTS_WITH);
        Redirector redirector = new Redirector(getContext(), target, Redirector.MODE_SERVER_OUTBOUND);
        router.attach("/v2", redirector);
        router.attach("/", new Directory(getContext(), "war:///"));
        return router;
    }
View Full Code Here

        router.attach(FREEDOMOTIC_PATH+"/commands/user/", UserCommandsServerResource.class);
        router.attach(FREEDOMOTIC_PATH+"/triggers/", TriggersServerResource.class);
        router.attach(FREEDOMOTIC_PATH+"/resources/{filename}", ImageResourceServerResource.class);   
        router.attach(USER_PATH + "/{useraction}", UserServerResource.class);
        //Expose the resources dir as static server
        Directory dir = new Directory(getContext(), FILE_AND_SLASHES + resourcesPath);
        dir.setListingAllowed(true);
        //System.out.println("FILE_AND_SLASHES+resourcesPath "+  FILE_AND_SLASHES+resourcesPath);
        router.attach(RESOURCES_PATH + "/", dir);
        return router;
    }
View Full Code Here

       
    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

    }

  @Override
  public Restlet getRestlet(Context context) {
        Router router = new Router(context);
        router.attach("", new Directory(context, "clap://classloader/web/"));
        context.setClientDispatcher(new Client(context, Protocol.CLAP));
        return router;
  }
View Full Code Here

            Component component = new Component();
            server.setInboundRoot(component);
            component.getServers().add(Protocol.HTTP, port);
            component.getServers().add(Protocol.FILE, port);

            component.getDefaultHost().attach("/", new Directory(server.getContext(), "file://" + staticContentDir + "/"));

            for (TwitLogic.ResourceType t : TwitLogic.ResourceType.values()) {
                String p = t.getUriPath();
                if (!p.equals("graph") && !p.equals("person")) {
                    component.getDefaultHost().attach("/" + p + "/", WebResource.class);
View Full Code Here

    // Root
    router.attach("/", RootResource.class);
    router.attach("", RootResource.class);

    // static resources
    Directory dir = new Directory(context, "clap://class");
    dir.setListingAllowed(true);
    dir.setDeeplyAccessible(true);
    router.attach("/", dir);

    if (config.getProxyPort() > 0) {
      getLogger().info(MessageFormat.format(Constants.MESSAGE_STARTUP, "PROXY", config.getProxyPort()));
    }
View Full Code Here

TOP

Related Classes of org.restlet.resource.Directory

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.