Package org.gwizard.web
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 Summary
ConstructorsConstructorDescriptionWebServer(WebConfig webConfig, EventListenerScanner eventListenerScanner, HandlerScanner handlerScanner) -
Method Summary
Modifier and TypeMethodDescriptionprotected org.eclipse.jetty.servlet.ServletContextHandlerOverrideable method to create the root ServletContextHandler.protected org.eclipse.jetty.server.ServercreateServer(WebConfig webConfig)Overrideable method to create the initial jetty Server.voidstart()Start the web server.voidstop()signal the web server to stop
-
Constructor Details
-
WebServer
@Inject public WebServer(WebConfig webConfig, EventListenerScanner eventListenerScanner, HandlerScanner handlerScanner)
-
-
Method Details
-
start
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
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
signal the web server to stop- Throws:
Exception
-