Package org.eclipse.jetty.server.handler

Examples of org.eclipse.jetty.server.handler.ResourceHandler


      return handlers;
   }

   private ResourceHandler staticResourceHandler(final String classPathResource, final String... staticResources) {

      final ResourceHandler resourceHandler = new ResourceHandler();
      resourceHandler.setDirectoriesListed(true);
      resourceHandler.setWelcomeFiles(staticResources);
      resourceHandler.setBaseResource(Resource.newClassPathResource(classPathResource));

      return resourceHandler;
   }
View Full Code Here


      return handlers;
   }

   private ResourceHandler contextRootHandler(final String classPathResource, final String welcomeFile) {

      final ResourceHandler resourceHandler = new ResourceHandler();
      resourceHandler.setDirectoriesListed(true);
      resourceHandler.setWelcomeFiles(new String[]{welcomeFile});
      resourceHandler.setBaseResource(Resource.newClassPathResource(classPathResource));

      return resourceHandler;
   }
View Full Code Here

        Server server = new Server();
        SelectChannelConnector connector = new SelectChannelConnector();
        connector.setPort(port);
        server.addConnector(connector);

        ResourceHandler resource_handler = new ResourceHandler();
        resource_handler.setDirectoriesListed(true);
        resource_handler.setWelcomeFiles(new String[] { "index.html" });

        resource_handler.setResourceBase("./performance/site/");

        HandlerList handlers = new HandlerList();
        handlers.setHandlers(new Handler[] { resource_handler,
                new DefaultHandler() });
        server.setHandler(handlers);
View Full Code Here

      return handlers;
   }

   private ResourceHandler staticResourceHandler(final String classPathResource, final String... staticResources) {

      final ResourceHandler resourceHandler = new ResourceHandler();
      resourceHandler.setDirectoriesListed(true);
      resourceHandler.setWelcomeFiles(staticResources);
      resourceHandler.setBaseResource(Resource.newClassPathResource(classPathResource));

      return resourceHandler;
   }
View Full Code Here

  private int port;

  @Before
  public void setup() throws Exception {
    server = new Server(0);
    ResourceHandler handler = new ResourceHandler();
    handler.setBaseResource(Resource.newClassPathResource("/site"));

    ConstraintSecurityHandler csh = newSecurityHandler(handler);

    server.setHandler(csh);
    server.start();
View Full Code Here

    resource = classPathResource;
  }

  public void start() throws Exception {
    server = new Server(0);
    ResourceHandler handler = new ResourceHandler();
    handler.setBaseResource(resource);
    server.setHandler(handler);
    server.start();
    this.port = ((ServerConnector) server.getConnectors()[0]).getLocalPort();
    this.demoSite = URI.create("http://localhost:" + port + "/");
    this.started = true;
View Full Code Here

   *
   * @return a {@link Server}.
   */
  protected Server newWebServer() {
    Server server = new Server(0);
    ResourceHandler handler = new ResourceHandler();
    handler.setBaseResource(resource);
    server.setHandler(handler);
    return server;
  }
View Full Code Here

      return handlers;
   }

   private ResourceHandler staticResourceHandler(final String classPathResource, final String... staticResources) {

      final ResourceHandler resourceHandler = new ResourceHandler();
      resourceHandler.setDirectoriesListed(true);
      resourceHandler.setWelcomeFiles(staticResources);
      resourceHandler.setBaseResource(Resource.newClassPathResource(classPathResource));

      return resourceHandler;
   }
View Full Code Here

              if (directoriesListed != null) {

                final String welcomeFiles = properties.getProperty(resourceHandlerName.concat(".welcomeFiles"));
                if (welcomeFiles != null) {

                  ResourceHandler resourceHandler = new ResourceHandler();
                  resourceHandler.setDirectoriesListed(Boolean.parseBoolean(directoriesListed));
                  resourceHandler.setWelcomeFiles(StringUtils.split(welcomeFiles));
                  resourceHandler.setResourceBase(resourceBase);
                  ContextHandler staticResourceHandler = new ContextHandler();
                  staticResourceHandler.setContextPath(contextPath);
                  staticResourceHandler.setHandler(resourceHandler);

                  resourceHandlers.add(staticResourceHandler);
View Full Code Here

    Server server = new Server();
    SelectChannelConnector connector = new SelectChannelConnector();
        connector.setPort(Integer.parseInt(port));
        server.addConnector(connector);
        ResourceHandler resource_handler = new ResourceHandler();
        resource_handler.setDirectoriesListed(true);
        resource_handler.setWelcomeFiles(new String[]{ "index.html" });
        resource_handler.setResourceBase(path);
        HandlerList handlers = new HandlerList();
        handlers.setHandlers(new Handler[] { resource_handler, new DefaultHandler() });
        server.setHandler(handlers);
View Full Code Here

TOP

Related Classes of org.eclipse.jetty.server.handler.ResourceHandler

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.