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


    @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

        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

      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 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 startJettyServer()
        throws Exception
    {
        Server server = new Server( 0 );
        ResourceHandler handler = new ResourceHandler();
        handler.setResourceBase( getTestFile( "src/test/resources" ).getAbsolutePath() );
        HandlerList handlers = new HandlerList();
        handlers.setHandlers( new Handler[]{ handler, new DefaultHandler() } );
        server.setHandler( handlers );
        server.start();
        return server;
View Full Code Here

        jspHandler.setClassLoader(Thread.currentThread().getContextClassLoader());
        jspHandler.addServlet(DefaultServlet.class, "/");
        ServletHolder jsp = jspHandler.addServlet(JspServlet.class, "*.jsp");
        jsp.setInitParameter("classpath", jspHandler.getClassPath());
        //
    ResourceHandler resourceHandler = new ResourceHandler();
    resourceHandler.setDirectoriesListed(true);
    resourceHandler.setWelcomeFiles(new String[]{ "index.html" });
    rootDir = ducc_web+File.separator+"root";
    resourceHandler.setResourceBase(rootDir);
    //
    try {
      Properties properties = DuccWebProperties.get();
      String ducc_runmode = properties.getProperty("ducc.runmode","Production");
      logger.debug(methodName, null, "ducc.runmode:"+ducc_runmode);
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

      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

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.