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 provideDynamicServlet
for 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.HttpServlet
servlet
The wrapped servlet.protected String
servletName
The name of the servlet ornull
in 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 void
destroy()
javax.servlet.ServletConfig
getServletConfig()
String
getServletInfo()
String
getServletName()
Gets the name of the servlet.void
init(javax.servlet.ServletConfig config)
void
service(javax.servlet.ServletRequest req, javax.servlet.ServletResponse res)
void
servletDeployed(javax.servlet.ServletContext context, String urlPattern)
Notifies the servlet that it has been deployed with the designated context and the designated pattern.void
servletUndeployed(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 ornull
in 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 ornull
in 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:
init
in interfacejavax.servlet.Servlet
- Throws:
javax.servlet.ServletException
-
getServletConfig
public javax.servlet.ServletConfig getServletConfig()
- Specified by:
getServletConfig
in interfacejavax.servlet.Servlet
-
service
public void service(javax.servlet.ServletRequest req, javax.servlet.ServletResponse res) throws javax.servlet.ServletException, IOException
- Specified by:
service
in interfacejavax.servlet.Servlet
- Throws:
javax.servlet.ServletException
IOException
-
getServletInfo
public String getServletInfo()
- Specified by:
getServletInfo
in interfacejavax.servlet.Servlet
-
destroy
public void destroy()
- Specified by:
destroy
in interfacejavax.servlet.Servlet
-
getServletName
public String getServletName()
Description copied from interface:DynamicServlet
Gets 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:
getServletName
in interfaceDynamicServlet
- Returns:
- The name of the servlet.
-
servletDeployed
public void servletDeployed(javax.servlet.ServletContext context, String urlPattern)
Description copied from interface:DynamicServlet
Notifies 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:
servletDeployed
in 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:DynamicServlet
Notifies the servlet that it has been undeployed.- Specified by:
servletUndeployed
in interfaceDynamicServlet
- Parameters:
context
- The servlet context of this servlet.
-
-