Class DynamicServletWrapper
- java.lang.Object
-
- de.aristaflow.adept2.base.servletcontainer.DynamicServletWrapper
-
- All Implemented Interfaces:
DynamicServlet,javax.servlet.Servlet
public class DynamicServletWrapper extends Object implements DynamicServlet
A simple wrapper to provideDynamicServletfor aHttpServlet. This class forwards all calls, the name can be overridden, notifications for a servlet being (un)deployed are ignored.
-
-
Field Summary
Fields Modifier and Type Field Description protected javax.servlet.http.HttpServletservletThe wrapped servlet.protected StringservletNameThe name of the servlet ornullin case it should be retrieved from the wrapped servlet.
-
Constructor Summary
Constructors Constructor Description DynamicServletWrapper(String servletName, javax.servlet.http.HttpServlet servlet)Creates a new wrapper for the designated servlet.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddestroy()javax.servlet.ServletConfiggetServletConfig()StringgetServletInfo()StringgetServletName()Gets the name of the servlet.voidinit(javax.servlet.ServletConfig config)voidservice(javax.servlet.ServletRequest req, javax.servlet.ServletResponse res)voidservletDeployed(javax.servlet.ServletContext context, String urlPattern)Notifies the servlet that it has been deployed with the designated context and the designated pattern.voidservletUndeployed(javax.servlet.ServletContext context)Notifies the servlet that it has been undeployed.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.aristaflow.adept2.base.servletcontainer.DynamicServlet
servletDeployed
-
-
-
-
Field Detail
-
servletName
protected String servletName
The name of the servlet ornullin case it should be retrieved from the wrapped servlet.
-
servlet
protected final javax.servlet.http.HttpServlet servlet
The wrapped servlet.
-
-
Constructor Detail
-
DynamicServletWrapper
public DynamicServletWrapper(String servletName, javax.servlet.http.HttpServlet servlet)
Creates a new wrapper for the designated servlet.- Parameters:
servletName- The name of the servlet ornullin case it should be retrieved from the designated servlet.servlet- The wrapped servlet.
-
-
Method Detail
-
init
public void init(javax.servlet.ServletConfig config) throws javax.servlet.ServletException- Specified by:
initin interfacejavax.servlet.Servlet- Throws:
javax.servlet.ServletException
-
getServletConfig
public javax.servlet.ServletConfig getServletConfig()
- Specified by:
getServletConfigin interfacejavax.servlet.Servlet
-
service
public void service(javax.servlet.ServletRequest req, javax.servlet.ServletResponse res) throws javax.servlet.ServletException, IOException- Specified by:
servicein interfacejavax.servlet.Servlet- Throws:
javax.servlet.ServletExceptionIOException
-
getServletInfo
public String getServletInfo()
- Specified by:
getServletInfoin interfacejavax.servlet.Servlet
-
destroy
public void destroy()
- Specified by:
destroyin interfacejavax.servlet.Servlet
-
getServletName
public String getServletName()
Description copied from interface:DynamicServletGets the name of the servlet. Note that usually the servlet implementations rely on the servlet configuration to provide a name. However, when using aDynamicServlet, the servlet name has to be provided explicitly.- Specified by:
getServletNamein interfaceDynamicServlet- Returns:
- The name of the servlet.
-
servletDeployed
public void servletDeployed(javax.servlet.ServletContext context, String urlPattern)Description copied from interface:DynamicServletNotifies the servlet that it has been deployed with the designated context and the designated pattern. Note that the servlet usually will not have been initialised yet.- Specified by:
servletDeployedin interfaceDynamicServlet- Parameters:
context- The servlet context of this servlet.urlPattern- The URL pattern (mapping) this servlet has been deployed with.
-
servletUndeployed
public void servletUndeployed(javax.servlet.ServletContext context)
Description copied from interface:DynamicServletNotifies the servlet that it has been undeployed.- Specified by:
servletUndeployedin interfaceDynamicServlet- Parameters:
context- The servlet context of this servlet.
-
-