Class WebServer

java.lang.Object
org.gwizard.web.WebServer

@Singleton
public class WebServer
extends Object
Simple Jetty-based embedded web server which configures itself from a bound WebConfig and serves the GuiceFilter so you can manage web content with Guice ServletModules. Also clever enough to add any EventListener objects found in the injector bindings.
  • Constructor Details

  • Method Details

    • start

      public void start() throws Exception
      Start the web server. Does not block.
      Throws:
      Exception
      See Also:
      AbstractLifeCycle.start()
    • createRootServletContextHandler

      protected org.eclipse.jetty.servlet.ServletContextHandler createRootServletContextHandler()
      Overrideable method to create the root ServletContextHandler. This can be used so that the Server can have a ServletContextHandler that will be able to handle Sessions for example. By default we create a bare-bones ServletContextHandler that is not set up to handle Sessions.
    • createServer

      protected org.eclipse.jetty.server.Server createServer(WebConfig webConfig)
      Overrideable method to create the initial jetty Server. We need to draw a lot more configuration parameters into WebConfig, but for now this gives users a hook to satisfy their needs. Bind a subclass to WebConfig, subclass this WebServer, and change behavior to whatever you want.
    • stop

      public void stop() throws Exception
      signal the web server to stop
      Throws:
      Exception