Class DynamicServletWrapper
java.lang.Object
de.aristaflow.adept2.base.servletcontainer.DynamicServletWrapper
- All Implemented Interfaces:
DynamicServlet,jakarta.servlet.Servlet
A simple wrapper to provide
DynamicServlet for a HttpServlet. This
class forwards all calls, the name can be overridden, notifications for a servlet being
(un)deployed are ignored.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final jakarta.servlet.http.HttpServletThe wrapped servlet.protected StringThe name of the servlet ornullin case it should be retrieved from the wrapped servlet. -
Constructor Summary
ConstructorsConstructorDescriptionDynamicServletWrapper(String servletName, jakarta.servlet.http.HttpServlet servlet) Creates a new wrapper for the designated servlet. -
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()jakarta.servlet.ServletConfigGets the name of the servlet.voidinit(jakarta.servlet.ServletConfig config) voidservice(jakarta.servlet.ServletRequest req, jakarta.servlet.ServletResponse res) voidservletDeployed(jakarta.servlet.ServletContext context, Collection<String> urlPatterns) Notifies the servlet that it has been deployed with the designated context and the designated patterns.voidservletUndeployed(jakarta.servlet.ServletContext context) Notifies the servlet that it has been undeployed.
-
Field Details
-
servletName
The name of the servlet ornullin case it should be retrieved from the wrapped servlet. -
servlet
protected final jakarta.servlet.http.HttpServlet servletThe wrapped servlet.
-
-
Constructor Details
-
DynamicServletWrapper
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 Details
-
init
public void init(jakarta.servlet.ServletConfig config) throws jakarta.servlet.ServletException - Specified by:
initin interfacejakarta.servlet.Servlet- Throws:
jakarta.servlet.ServletException
-
getServletConfig
public jakarta.servlet.ServletConfig getServletConfig()- Specified by:
getServletConfigin interfacejakarta.servlet.Servlet
-
service
public void service(jakarta.servlet.ServletRequest req, jakarta.servlet.ServletResponse res) throws jakarta.servlet.ServletException, IOException - Specified by:
servicein interfacejakarta.servlet.Servlet- Throws:
jakarta.servlet.ServletExceptionIOException
-
getServletInfo
- Specified by:
getServletInfoin interfacejakarta.servlet.Servlet
-
destroy
public void destroy()- Specified by:
destroyin interfacejakarta.servlet.Servlet
-
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
Description copied from interface:DynamicServletNotifies the servlet that it has been deployed with the designated context and the designated patterns. Note that the servlet usually will not have been initialised yet.- Specified by:
servletDeployedin interfaceDynamicServlet- Parameters:
context- The servlet context of this servlet.urlPatterns- The URL patterns (mapping) this servlet has been deployed with.
-
servletUndeployed
public void servletUndeployed(jakarta.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.
-