Package org.eclipse.jetty.server.handler

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


    @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


        connector.setPort(0);

        server.addConnector(connector);

        final HandlerCollection handlers = new HandlerCollection();
        final ResourceHandler resourceHandler = new ResourceHandler() {
            @Override
            protected void doResponseHeaders(final HttpServletResponse response, final Resource resource, final String mimeType) {
                response.addDateHeader("Expires", 0L);
            }
        };

        resourceHandler.setDirectoriesListed(true);
        resourceHandler.setResourceBase(resourceBase);

        handlers.addHandler(resourceHandler);

        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

        ServerSocket sock = new ServerSocket(0);
        int port = sock.getLocalPort();
        Server server = new Server(port);
        sock.close();

        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:"
            + port + "/hello_world.wsdl");
        env.put(ToolConstants.CFG_BINDING, "http://localhost:"
            + port + "/remote-hello_world_binding.xsd");
        processor.setContext(env);
        processor.execute();
        try {
            reshandler.stop();
        } finally {
            server.stop();
            server.destroy();
        }
View Full Code Here

    servletContext.addServlet(new ServletHolder(new JobmanagerInfoServlet(jobmanager)), "/jobsInfo");
    servletContext.addServlet(new ServletHolder(new LogfileInfoServlet(new File(logDirPath))), "/logInfo");


    // ----- the handler serving all the static files -----
    ResourceHandler resourceHandler = new ResourceHandler();
    resourceHandler.setDirectoriesListed(false);
    resourceHandler.setResourceBase(webDir.getAbsolutePath());

    // ----- add the handlers to the list handler -----
    HandlerList handlers = new HandlerList();
    handlers.addHandler(servletContext);
    handlers.addHandler(resourceHandler);
View Full Code Here

    servletContext.addServlet(new ServletHolder(new JobsServlet(uploadDir, tmpDir, "launch.html")), "/jobs");
    servletContext.addServlet(new ServletHolder(new JobSubmissionServlet(nepheleConfig, uploadDir, planDumpDir)),
      "/runJob");

    // ----- the hander serving the written pact plans -----
    ResourceHandler pactPlanHandler = new ResourceHandler();
    pactPlanHandler.setDirectoriesListed(false);
    pactPlanHandler.setResourceBase(planDumpDir.getAbsolutePath());
    ContextHandler pactPlanContext = new ContextHandler();
    pactPlanContext.setContextPath("/ajax-plans");
    pactPlanContext.setHandler(pactPlanHandler);

    // ----- the handler serving all the static files -----
    ResourceHandler resourceHandler = new ResourceHandler();
    resourceHandler.setDirectoriesListed(false);
    resourceHandler.setResourceBase(webDir.getAbsolutePath());

    // ----- add the handlers to the list handler -----
    HandlerList handlers = new HandlerList();
    handlers.addHandler(servletContext);
    handlers.addHandler(pactPlanContext);
View Full Code Here

   * @return the url for the pendant interface
   */
  public List<PendantURLBean> start(){
            server = new Server(port);

            ResourceHandler resourceHandler = new ResourceHandler();
            resourceHandler.setDirectoriesListed(false);
            resourceHandler.setWelcomeFiles(new String[]{ "index.html" });
            resourceHandler.setBaseResource(getBaseResource());
            resourceHandler.setDirectoriesListed(true);

            ContextHandler sendGcodeContext = new ContextHandler();
            sendGcodeContext.setContextPath("/sendGcode");
            sendGcodeContext.setBaseResource(getBaseResource());
            sendGcodeContext.setClassLoader(Thread.currentThread().getContextClassLoader());
View Full Code Here

        CompositeResourceAccessor resourceAccessor = new CompositeResourceAccessor(
                new CommandLineResourceAccessor(new URLClassLoader(jarUrls.toArray(new URL[jarUrls.size()]), this.getClass().getClassLoader()))
        );
        Database database = DatabaseFactory.getInstance().openDatabase(url, username, password, null, resourceAccessor);

        ResourceHandler staticHandler = new ResourceHandler();
        staticHandler.setDirectoriesListed(false);
        staticHandler.setWelcomeFiles(new String[]{"index.html"});
        staticHandler.setResourceBase(getClass().getClassLoader().getResource("liquibase/sdk/watch/index.html.vm").toExternalForm().replaceFirst("index.html.vm$", ""));

        HandlerList handlers = new HandlerList();
        handlers.setHandlers(new Handler[]{new DynamicContentHandler(database), staticHandler, new DefaultHandler()});

        server.setHandler(handlers);
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(basePath);
        ServletContextHandler postServletcontext = new ServletContextHandler(ServletContextHandler.SESSIONS);
        postServletcontext.setContextPath("/");
        postServletcontext.addServlet(new ServletHolder(new PostServlet()),"/*");
       
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.