public abstract class OfficeFloorServlet
extends javax.servlet.http.HttpServlet
implements javax.servlet.ServletContextListener, javax.servlet.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,
javax.servlet.ServletContext servletContext)
Provides configuration of the
WebAutoWireApplication for this
OfficeFloorServlet . |
void |
contextDestroyed(javax.servlet.ServletContextEvent event) |
void |
contextInitialized(javax.servlet.ServletContextEvent event) |
void |
destroy() |
void |
doFilter(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response,
javax.servlet.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(javax.servlet.FilterConfig filterConfig) |
protected void |
service(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) |
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service
public abstract String getServletName()
Servlet
.getServletName
in interface javax.servlet.ServletConfig
getServletName
in class javax.servlet.GenericServlet
Servlet
.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, javax.servlet.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(javax.servlet.ServletContextEvent event)
contextInitialized
in interface javax.servlet.ServletContextListener
public void contextDestroyed(javax.servlet.ServletContextEvent event)
contextDestroyed
in interface javax.servlet.ServletContextListener
public String getServletInfo()
getServletInfo
in interface javax.servlet.Servlet
getServletInfo
in class javax.servlet.GenericServlet
public void init() throws javax.servlet.ServletException
init
in class javax.servlet.GenericServlet
javax.servlet.ServletException
public String getInitParameter(String name)
getInitParameter
in interface javax.servlet.ServletConfig
getInitParameter
in class javax.servlet.GenericServlet
protected void service(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, IOException
service
in class javax.servlet.http.HttpServlet
javax.servlet.ServletException
IOException
public void destroy()
destroy
in interface javax.servlet.Filter
destroy
in interface javax.servlet.Servlet
destroy
in class javax.servlet.GenericServlet
public void init(javax.servlet.FilterConfig filterConfig) throws javax.servlet.ServletException
init
in interface javax.servlet.Filter
javax.servlet.ServletException
public void doFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain) throws IOException, javax.servlet.ServletException
doFilter
in interface javax.servlet.Filter
IOException
javax.servlet.ServletException
Copyright © 2005–2016. All rights reserved.