public abstract class OfficeFloorServlet extends HttpServlet implements ServletContextListener, Filter
HttpServlet to service HttpServletRequest instances via
WebAutoWireApplication.
To use this class:
Servlet application as a
ServletContextListener.
Note that the implementation requires to be configured as a
ServletContextListener (rather than a Servlet) as it
configures itself with its appropriate request handling mappings.
Please also note that the instance used for the
ServletContextListener is not the instance used as the
HttpServlet. This is necessary as a new instance of the
OfficeFloorServlet implementation is created by the Servlet
container to allow it to manage dependency injection of resources.
This also implements Filter because many JEE Servlet
implementations register their default Servlet to service resources
before the ServletContextListener configuration of this
OfficeFloorServlet. By also being a Filter servicing the same
mappings it overcomes this issue.
| Constructor and Description |
|---|
OfficeFloorServlet() |
| Modifier and Type | Method and Description |
|---|---|
abstract boolean |
configure(WebAutoWireApplication application,
ServletContext servletContext)
Provides configuration of the
WebAutoWireApplication for this
OfficeFloorServlet. |
void |
contextDestroyed(ServletContextEvent event) |
void |
contextInitialized(ServletContextEvent event) |
void |
destroy() |
void |
doFilter(ServletRequest request,
ServletResponse response,
FilterChain chain) |
String |
getInitParameter(String name) |
String |
getServletInfo() |
abstract String |
getServletName()
Obtains the name to register this
Servlet. |
abstract String |
getTemplateUriSuffix()
Obtains the
HttpTemplate URI suffix. |
void |
init() |
void |
init(FilterConfig filterConfig) |
protected void |
service(HttpServletRequest request,
HttpServletResponse response) |
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, servicegetInitParameterNames, getServletConfig, getServletContext, init, log, logpublic abstract String getServletName()
Servlet.getServletName in interface ServletConfiggetServletName in class GenericServletServlet.public abstract String getTemplateUriSuffix()
Obtains the HttpTemplate URI suffix.
Must provide a URI suffix to enable Servlet mapping for link URL
continuations.
HttpTemplate URI suffix.public abstract boolean configure(WebAutoWireApplication application, ServletContext servletContext) throws Exception
WebAutoWireApplication for this
OfficeFloorServlet.application - WebAutoWireApplication.servletContext - ServletContext.true to load the OfficeFloorServlet.
false does not configure it.Exception - If fails to configure.public void contextInitialized(ServletContextEvent event)
contextInitialized in interface ServletContextListenerpublic void contextDestroyed(ServletContextEvent event)
contextDestroyed in interface ServletContextListenerpublic String getServletInfo()
getServletInfo in interface ServletgetServletInfo in class GenericServletpublic void init()
throws ServletException
init in class GenericServletServletExceptionpublic String getInitParameter(String name)
getInitParameter in interface ServletConfiggetInitParameter in class GenericServletprotected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
service in class HttpServletServletExceptionIOExceptionpublic void destroy()
public void init(FilterConfig filterConfig) throws ServletException
init in interface FilterServletExceptionpublic void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException
doFilter in interface FilterIOExceptionServletExceptionCopyright © 2005–2015. All rights reserved.