Class GuiceServlet
java.lang.Object
javax.servlet.GenericServlet
javax.servlet.http.HttpServlet
com.peterphi.std.guice.web.servlet.GuiceServlet
- All Implemented Interfaces:
GuiceApplication
,Serializable
,javax.servlet.Servlet
,javax.servlet.ServletConfig
public abstract class GuiceServlet
extends javax.servlet.http.HttpServlet
implements GuiceApplication
Basic Guice-aware servlet that is configured at invocation time and restarted using
Feeds Servlet lifecycle events back to
Overrides
GuiceRegistry
Feeds Servlet lifecycle events back to
GuiceRegistry
to perform orderly shutdown of servicesOverrides
HttpServlet.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
to perform lazy configuration. See the doService
method if you need to
override service
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal void
Called when a new Injector has been created, after Guice injection has been applied to this instance.final void
destroy()
protected void
doService
(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) CallsHttpServlet.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
should a subclass need to implement that methodprotected final void
service
(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) abstract void
stopping()
Called when an Injector is stopping and before the ShutdownManager for the GuiceRegistry is signalled
The GuiceRegistry will wait for this method to return before proceeding.Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service
Methods inherited from class javax.servlet.GenericServlet
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log
-
Constructor Details
-
GuiceServlet
public GuiceServlet()
-
-
Method Details
-
service
protected final void service(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws javax.servlet.ServletException, IOException - Overrides:
service
in classjavax.servlet.http.HttpServlet
- Throws:
javax.servlet.ServletException
IOException
-
doService
protected void doService(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws javax.servlet.ServletException, IOException CallsHttpServlet.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
should a subclass need to implement that method- Parameters:
req
-resp
-- Throws:
javax.servlet.ServletException
IOException
-
configured
public final void configured()Description copied from interface:GuiceApplication
Called when a new Injector has been created, after Guice injection has been applied to this instance. No guarantees are made about the order in which GuiceApplication instances will be called- Specified by:
configured
in interfaceGuiceApplication
-
destroy
public final void destroy()- Specified by:
destroy
in interfacejavax.servlet.Servlet
- Overrides:
destroy
in classjavax.servlet.GenericServlet
-
stopping
public abstract void stopping()Description copied from interface:GuiceApplication
Called when an Injector is stopping and before the ShutdownManager for the GuiceRegistry is signalled
The GuiceRegistry will wait for this method to return before proceeding. No guarantees are made about the order in which GuiceApplication instances will be called- Specified by:
stopping
in interfaceGuiceApplication
-