Interface IServletWrapper
-
- All Superinterfaces:
RequestProcessor
- All Known Implementing Classes:
GenericServletWrapper
public interface IServletWrapper extends RequestProcessor
Generic RequestProcessor representation of a compiled servlet. Any entity which ends up begin a Servlet will be wrapper by a wrapper of this type. This wrapper may be added as targets into the ServletContext, and the webcontainer will dispatch requests intended for this resource in an optimized way. NOTE: Components wishing to provide their own servlet wrappers are strongly urged to extend the GenericServletWrapper class, which has convenience methods to help with better integration with the webcontainer- See Also:
GenericServletWrapper
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddServletReferenceListener(ServletReferenceListener wrapper)Adds a ServletReferenceListener to this wrappervoiddestroy()Signals that this wrapper should now be destroyed.longgetLastAccessTime()Returns the time when this wrapper was last accessedIServletConfiggetServletConfig()Returns the servlet config associated with this servlet wrapperjavax.servlet.ServletContextgetServletContext()Returns the servlet context associated with this servlet wrapper.java.lang.StringgetServletName()Returns the servlet name of the servlet wrapped by this servlet wrapperjavax.servlet.ServletgetTarget()Gets the target Servlet that this wrapper is wrappingjava.lang.ClassLoadergetTargetClassLoader()Returns the ClassLoader instance that was used to load, or will be used to load the Servlet wrapped by this servlet wrappervoidhandleRequest(javax.servlet.ServletRequest req, javax.servlet.ServletResponse res)This method will be called by the webcontainer when a request is intended for this wrapper.voidinitialize(IServletConfig config)Initializes this wrapper with the specified config.booleanisAvailable()Returns whether the requested wrapper resource exists.voidload()Loads the servlet and calls the Servlet's init method with the previously passed IServletConfig.voidloadOnStartupCheck()Initializes this wrapper with the specified config.voidmodifyTarget(javax.servlet.Servlet s)voidprepareForReload()Signals that this wrapper is going to be recycledvoidservice(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response)voidsetParent(IServletContext parent)Sets the parent context for this servletwrappervoidsetTarget(javax.servlet.Servlet target)Sets the target Servlet that this wrapper should wrapvoidsetTargetClassLoader(java.lang.ClassLoader loader)Instructs the webcontainer to use the specified ClassLoader to load the Servlet wrapped by this servlet wrapper.-
Methods inherited from interface com.ibm.wsspi.webcontainer.RequestProcessor
getName, isInternal
-
-
-
-
Method Detail
-
getServletConfig
IServletConfig getServletConfig()
Returns the servlet config associated with this servlet wrapper- Returns:
-
getServletContext
javax.servlet.ServletContext getServletContext()
Returns the servlet context associated with this servlet wrapper.- Returns:
-
setParent
void setParent(IServletContext parent)
Sets the parent context for this servletwrapper
-
getServletName
java.lang.String getServletName()
Returns the servlet name of the servlet wrapped by this servlet wrapper- Returns:
-
setTargetClassLoader
void setTargetClassLoader(java.lang.ClassLoader loader)
Instructs the webcontainer to use the specified ClassLoader to load the Servlet wrapped by this servlet wrapper.- Parameters:
loader-
-
getTargetClassLoader
java.lang.ClassLoader getTargetClassLoader()
Returns the ClassLoader instance that was used to load, or will be used to load the Servlet wrapped by this servlet wrapper- Parameters:
loader-
-
setTarget
void setTarget(javax.servlet.Servlet target)
Sets the target Servlet that this wrapper should wrap- Parameters:
target-
-
getTarget
javax.servlet.Servlet getTarget()
Gets the target Servlet that this wrapper is wrapping- Returns:
-
initialize
void initialize(IServletConfig config) throws java.lang.Exception
Initializes this wrapper with the specified config. Depending on the startup weight specified in the config, the underlying target Servlet will either be initialized within this call. NOTE: This initialization behaviour of the target Servlet can be controlled by calling the setStartUpWeight() method on the IServletConfig- Parameters:
config-- Throws:
java.lang.Exception- See Also:
IServletConfig
-
loadOnStartupCheck
void loadOnStartupCheck() throws java.lang.ExceptionInitializes this wrapper with the specified config. Depending on the startup weight specified in the config, the underlying target Servlet will either be initialized within this call. NOTE: This initialization behaviour of the target Servlet can be controlled by calling the setStartUpWeight() method on the IServletConfig- Parameters:
config-- Throws:
java.lang.Exception- See Also:
IServletConfig
-
handleRequest
void handleRequest(javax.servlet.ServletRequest req, javax.servlet.ServletResponse res) throws java.lang.ExceptionThis method will be called by the webcontainer when a request is intended for this wrapper. Classes directly implementing this interface (without extending GenericServletWrapper) will have to handle all aspects of the request processing. NOTE: Components wishing to provide their own servlet wrappers are strongly urged to extend the GenericServletWrapper class, which has convenience methods to help with better integration with the webcontainer. Subclasses can delegate request processing to the GenericServletWrapper by invoking the super.handleRequest() method- Specified by:
handleRequestin interfaceRequestProcessor- Throws:
java.lang.Exception
-
prepareForReload
void prepareForReload()
Signals that this wrapper is going to be recycled
-
addServletReferenceListener
void addServletReferenceListener(ServletReferenceListener wrapper)
Adds a ServletReferenceListener to this wrapper- Parameters:
wrapper-
-
getLastAccessTime
long getLastAccessTime()
Returns the time when this wrapper was last accessed- Returns:
-
destroy
void destroy()
Signals that this wrapper should now be destroyed.
-
service
void service(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response) throws java.io.IOException, javax.servlet.ServletException- Parameters:
request-response-- Throws:
java.io.IOExceptionjavax.servlet.ServletException
-
isAvailable
boolean isAvailable()
Returns whether the requested wrapper resource exists.
-
load
void load() throws java.lang.Exception
Loads the servlet and calls the Servlet's init method with the previously passed IServletConfig. One component that calls this is SIP.- Throws:
java.lang.Exception
-
modifyTarget
void modifyTarget(javax.servlet.Servlet s)
-
-