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


  private Server server;

  public HttpServer(int port) throws ServletException, IOException {
    server = new Server(port);
    ResourceHandler resource_handler = new ResourceHandler();
    resource_handler.setDirectoriesListed(true);
    resource_handler.setWelcomeFiles(new String[] { "index.html" });
    resource_handler.setResourceBase(new ClassPathResource("static")
        .getURI().toString());
    HandlerList handlers = new HandlerList();
    handlers.setHandlers(new Handler[] { resource_handler,
        new DefaultHandler() });
    server.setHandler(handlers);
View Full Code Here

        ForbiddenWordUtils.setForbiddenWordFetchURL("http://localhost:10090/forbidden-test.txt");
        ForbiddenWordUtils.setReloadInterval(500);
        ForbiddenWordUtils.initRemoteFetch();

        Server server = new Server(10090);
        ResourceHandler resourceHandler = new ResourceHandler();
        resourceHandler.setDirectoriesListed(true);
        resourceHandler.setBaseResource(Resource.newClassPathResource("."));
        server.setHandler(resourceHandler);
        server.start();

        Thread.sleep(1500);
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

        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

            path = ROOT;
        }

        if (resourceBase != null)
        {
            ResourceHandler resourceHandler = new ResourceHandler();
            ContextHandler resourceContextHandler = new ContextHandler(contexts, path);
            resourceHandler.setResourceBase(resourceBase);
            resourceContextHandler.setHandler(resourceHandler);
        }

        ServletContextHandler servletContext = new ServletContextHandler(contexts, ROOT, ServletContextHandler.NO_SECURITY);
        servletContext.addEventListener(new MuleServletContextListener(muleContext, getName()));
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

  public void startServer() throws Exception  {
    server = new Server();
    SelectChannelConnector connector = new SelectChannelConnector();
    connector.setPort(8766);
    server.addConnector(connector);
    ResourceHandler handler = new ResourceHandler();
    handler.setDirectoriesListed(true);
    //handler.setWelcomeFiles(new String [] {"index.html"});
    handler.setResourceBase(this.docBase);
    HandlerList handlers = new HandlerList();
    handlers.setHandlers( new Handler[] { handler, new DefaultHandler() });
    server.setHandler(handlers);
    server.start();
    //server.join();
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

    @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

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.