Package org.eclipse.jetty.server.handler

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


    server.setHandler(handlers);
    server.start();
  }

  private ContextHandler createUpdateContext() {
    ResourceHandler resource_handler = new ResourceHandler();
    resource_handler.setDirectoriesListed(true);
    File rootFolder = new RootFolderSelector().getRootFolder();
    resource_handler.setResourceBase(new File(rootFolder, "src/test/resources/httpUpdateServerBase").getAbsolutePath());
    ContextHandler contextHandler = new ContextHandler();
    contextHandler.setHandler(resource_handler);
    contextHandler.setContextPath("/updates");
    return contextHandler;
  }
View Full Code Here


    ServletContextHandler servletContext = new ServletContextHandler(
        ServletContextHandler.SESSIONS);
    servletContext.setContextPath("/browser");
   
    ResourceHandler staticFilesHandler = new ResourceHandler();

      staticFilesHandler.setResourceBase("src/main/html");

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

      server.addConnector(connector);

      QueuedThreadPool threadPool = new QueuedThreadPool();
      threadPool.setDaemon(true);
      server.setThreadPool(threadPool);
      final ResourceHandler resHandler = new ResourceHandler();
      resHandler.setResourceBase(resourceBase.getAbsolutePath());
      final HandlerList handlerList = new HandlerList();
      handlerList.setHandlers(new Handler[] {resHandler, new DefaultHandler()});
      server.setHandler(handlerList);
      try {
        server.start();
View Full Code Here

    /**
     * Sets static file location if present
     */
    private static void setStaticFileLocationIfPresent(String staticFilesRoute, List<Handler> handlersInList) {
        if (staticFilesRoute != null) {
            ResourceHandler resourceHandler = new ResourceHandler();
            Resource staticResources = Resource.newClassPathResource(staticFilesRoute);
            resourceHandler.setBaseResource(staticResources);
            resourceHandler.setWelcomeFiles(new String[] {"index.html"});
            handlersInList.add(resourceHandler);
        }
    }
View Full Code Here

     */
    private static void setExternalStaticFileLocationIfPresent(String externalFilesRoute,
                                                               List<Handler> handlersInList) {
        if (externalFilesRoute != null) {
            try {
                ResourceHandler externalResourceHandler = new ResourceHandler();
                Resource externalStaticResources = Resource.newResource(new File(externalFilesRoute));
                externalResourceHandler.setBaseResource(externalStaticResources);
                externalResourceHandler.setWelcomeFiles(new String[] {"index.html"});
                handlersInList.add(externalResourceHandler);
            } catch (IOException exception) {
                exception.printStackTrace(); // NOSONAR
                System.err.println("Error during initialize external resource " + externalFilesRoute); // NOSONAR
            }
View Full Code Here

public class HTTPServer {

    public static void main(String[] args) throws Exception {
        InetSocketAddress bindAdress = new InetSocketAddress("localhost", 8888);
        Server server = new Server(bindAdress);
        ResourceHandler resourceHandler = new ResourceHandler();
        resourceHandler.setBaseResource(Resource.newClassPathResource("/org/apache/ivyde/sample/webappjsrepo/"));
        server.setHandler(resourceHandler);
        server.start();
        server.join();
    }
View Full Code Here

        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(resourceBase);

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

        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(resourceBase);

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

    @Test
    public void testHelloWorldExternalBindingFile() throws Exception {
        Server server = new Server(8585);

        ResourceHandler reshandler = new ResourceHandler();
        reshandler.setResourceBase(getLocation("/wsdl2java_wsdl/"));
        // this is the only handler we're supposed to need, so we don't need to 'add' it.
        server.setHandler(reshandler);
        server.start();
        env.put(ToolConstants.CFG_WSDLURL, "http://localhost:8585/hello_world.wsdl");
        env.put(ToolConstants.CFG_BINDING, "http://localhost:8585/remote-hello_world_binding.xsd");
        processor.setContext(env);
        processor.execute();
        try {
            reshandler.stop();
        } finally {
            server.stop();
            server.destroy();
        }
View Full Code Here

            }
            rewrite.setHandler(handlers);
           
            handlers.addHandler(handler);
           
            ResourceHandler resHandler = new ResourceHandler();
            resHandler.setResourceBase(webdir);
            resHandler.setDirectoriesListed(true);
            handlers.addHandler(resHandler);
           
            int port = Integer.valueOf(prop.getProperty("com.trendmicro.tme.grapheditor.port"));
            Server server = new Server(port);
            server.setHandler(rewrite);
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.