Package org.mortbay.jetty.handler

Examples of org.mortbay.jetty.handler.ResourceHandler


            TestUtils.writeFile(tmpDir+"/testweb/page"+i+".htm", TestUtils.randomText(5,10)+"<a href='page"+next+".htm'>page"+next+"</a>");
        }

        // run the web server
        Server server = new Server(8089);
        ResourceHandler resource_handler = new myResourceHandler();
        resource_handler.setResourceBase(tmpDir+"/testweb");
        HandlerList handlers = new HandlerList();
        handlers.setHandlers(new Handler[] {resource_handler, new DefaultHandler()});
        server.setHandler(handlers);
        server.start();
View Full Code Here


    {
      return;
    }

    server = new Server( 8082 );
    ResourceHandler resource_handler = new ResourceHandler();
    resource_handler.setResourceBase( ".\\src\\test-resources" );

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

      ContextHandlerCollection contexts = new ContextHandlerCollection();

      WebAppContext webAppContext = new WebAppContext(configLocation.getAbsolutePath(), contextPath);
      contexts.addHandler(webAppContext);

            ResourceHandler resourceHandler = new ResourceHandler();
            resourceHandler.setResourceBase(resourceBase);
           
      RequestLogHandler requestLogHandler = new RequestLogHandler();
      handlers.setHandlers(new Handler[] { contexts, resourceHandler, new DefaultHandler(), requestLogHandler });
      server.setHandler(handlers);
View Full Code Here

            }
           
            server.setConnectors(connectors);

            HandlerCollection handlers = new HandlerCollection();
            ResourceHandler resourceHandler = new ResourceHandler();
            resourceHandler.setResourceBase(resourceBase);
           
            ContextHandlerCollection contexts = new ContextHandlerCollection();

            WebAppContext webAppContext = new WebAppContext(configLocation.getAbsolutePath(), contextPath);
            contexts.addHandler(webAppContext);
View Full Code Here

       // r =
     // } else {
    //    r = Resource.newClassPathResource("uk/ac/cam/ch/wwmm/oscar3server/resources/cutdownweb/");       
     // }
      r.encode("UTF-8");
      ResourceHandler rh = new ResourceHandler();
      rh.setBaseResource(r);
      server.addHandler(rh);
      /*r = Resource.newClassPathResource("uk/ac/aber/art_tool/art_tool_web/javascript");
      r.encode("UTF-8");
      rh = new ResourceHandler();
      rh.setBaseResource(r);
View Full Code Here

    // Increase header buffer size to allow long URLs (particularly for
    // generic-host-page.html which puts the content into the URL).
    // (The Server(int) constructor adds one connector internally.)
    server.getConnectors()[0].setHeaderBufferSize(100 * 1024);

    final ResourceHandler cajaStatic = new ResourceHandler();
    cajaStatic.setResourceBase("./ant-war/");

    // static file serving for tests
    final ResourceHandler resource_handler = new ResourceHandler() {
      @Override
      protected void doResponseHeaders(HttpServletResponse response,
          Resource resource, String mimeType) {
        super.doResponseHeaders(response, resource, mimeType);

        // If not disabled, IE and Chrome will refuse to execute script text
        // which happens to occur in the URL (which applies to our
        // generic-host-page for one).
        response.setHeader("X-XSS-Protection", "0");
      }
    };
    resource_handler.setResourceBase(".");
    resource_handler.getMimeTypes().addMimeMapping(
        "ujs", "text/javascript;charset=utf-8");

    // caja (=playground for now) server under /caja directory
    final String subdir = "/caja";
    final ContextHandler caja = new ContextHandler(subdir);
View Full Code Here

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

        ResourceHandler reshandler = new ResourceHandler();
        reshandler.setResourceBase(getLocation("/wsdl2java_wsdl/"));
        server.addHandler(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

        int port=8080;
        if (args.length>=1)
            port=Integer.parseInt(args[0]);
        Server server = new Server(port);
       
        ResourceHandler resource_handler=new ResourceHandler();
        resource_handler.setResourceBase(args.length==2?args[1]:".");
       
        HandlerList handlers = new HandlerList();
        handlers.setHandlers(new Handler[]{resource_handler,new DefaultHandler()});
        server.setHandler(handlers);
       
View Full Code Here

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

        ResourceHandler reshandler = new ResourceHandler();
        reshandler.setResourceBase(getLocation("/wsdl2java_wsdl/"));
        server.addHandler(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

    }
   
    @Test
    public void testHelloWorldExternalBindingFile() throws Exception {
        Server server = new Server(8585);
        ResourceHandler reshandler = new ResourceHandler();
        reshandler.setResourceBase(getLocation("/wsdl2java_wsdl/"));
        server.addHandler(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);
View Full Code Here

TOP

Related Classes of org.mortbay.jetty.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.