FileDocCategorySizeDatePackage
Wrapper.javaAPI DocGlassfish v2 API11422Fri May 04 22:31:52 BST 2007org.apache.catalina

Wrapper

public interface Wrapper implements Container
A Wrapper is a Container that represents an individual servlet definition from the deployment descriptor of the web application. It provides a convenient mechanism to use Interceptors that see every single request to the servlet represented by this definition.

Implementations of Wrapper are responsible for managing the servlet life cycle for their underlying servlet class, including calling init() and destroy() at appropriate times, as well as respecting the existence of the SingleThreadModel declaration on the servlet class itself.

The parent Container attached to a Wrapper will generally be an implementation of Context, representing the servlet context (and therefore the web application) within which this servlet executes.

Child Containers are not allowed on Wrapper implementations, so the addChild() method should throw an IllegalArgumentException.

author
Craig R. McClanahan
version
$Revision: 1.3 $ $Date: 2007/05/05 05:31:52 $

Fields Summary
Constructors Summary
Methods Summary
public voidaddInitParameter(java.lang.String name, java.lang.String value)
Add a new servlet initialization parameter for this servlet.

param
name Name of this initialization parameter to add
param
value Value of this initialization parameter to add

public voidaddInstanceListener(InstanceListener listener)
Add a new listener interested in InstanceEvents.

param
listener The new listener

public voidaddMapping(java.lang.String mapping)
Add a mapping associated with the Wrapper.

param
pattern The new wrapper mapping

public voidaddSecurityReference(java.lang.String name, java.lang.String link)
Add a new security role reference record to the set of records for this servlet.

param
name Role name used within this servlet
param
link Role name used within the web application
param
description Description of this security role reference

public javax.servlet.Servletallocate()
Allocate an initialized instance of this Servlet that is ready to have its service() method called. If the servlet class does not implement SingleThreadModel, the (only) initialized instance may be returned immediately. If the servlet class implements SingleThreadModel, the Wrapper implementation must ensure that this instance is not allocated again until it is deallocated by a call to deallocate().

exception
ServletException if the servlet init() method threw an exception
exception
ServletException if a loading error occurs

public voiddeallocate(javax.servlet.Servlet servlet)
Return this previously allocated servlet to the pool of available instances. If this servlet class does not implement SingleThreadModel, no action is actually required.

param
servlet The servlet to be returned
exception
ServletException if a deallocation error occurs

public java.lang.StringfindInitParameter(java.lang.String name)
Return the value for the specified initialization parameter name, if any; otherwise return null.

param
name Name of the requested initialization parameter

public java.lang.String[]findInitParameters()
Return the names of all defined initialization parameters for this servlet.

public java.lang.String[]findMappings()
Return the mappings associated with this wrapper.

public java.lang.StringfindSecurityReference(java.lang.String name)
Return the security role link for the specified security role reference name, if any; otherwise return null.

param
name Security role reference used within this servlet

public java.lang.String[]findSecurityReferences()
Return the set of security role reference names associated with this servlet, if any; otherwise return a zero-length array.

public longgetAvailable()
Return the available date/time for this servlet, in milliseconds since the epoch. If this date/time is in the future, any request for this servlet will return an SC_SERVICE_UNAVAILABLE error. If it is zero, the servlet is currently available. A value equal to Long.MAX_VALUE is considered to mean that unavailability is permanent.

public java.lang.StringgetJspFile()
Return the context-relative URI of the JSP file for this servlet.

public intgetLoadOnStartup()
Return the load-on-startup order value (negative value means load on first call).

public java.lang.StringgetRunAs()
Return the run-as identity for this servlet.

public java.lang.StringgetServletClass()
Return the fully qualified servlet class name for this servlet.

public java.lang.String[]getServletMethods()
Gets the names of the methods supported by the underlying servlet. This is the same set of methods included in the Allow response header in response to an OPTIONS request method processed by the underlying servlet.

return
Array of names of the methods supported by the underlying servlet

public voidincrementErrorCount()
Increment the error count value used when monitoring.

public booleanisUnavailable()
Is this servlet currently unavailable?

public voidload()
Load and initialize an instance of this servlet, if there is not already at least one initialized instance. This can be used, for example, to load servlets that are marked in the deployment descriptor to be loaded at server startup time.

exception
ServletException if the servlet init() method threw an exception
exception
ServletException if some other loading problem occurs

public voidremoveInitParameter(java.lang.String name)
Remove the specified initialization parameter from this servlet.

param
name Name of the initialization parameter to remove

public voidremoveInstanceListener(InstanceListener listener)
Remove a listener no longer interested in InstanceEvents.

param
listener The listener to remove

public voidremoveMapping(java.lang.String mapping)
Remove a mapping associated with the wrapper.

param
mapping The pattern to remove

public voidremoveSecurityReference(java.lang.String name)
Remove any security role reference for the specified role name.

param
name Security role used within this servlet to be removed

public voidsetAvailable(long available)
Set the available date/time for this servlet, in milliseconds since the epoch. If this date/time is in the future, any request for this servlet will return an SC_SERVICE_UNAVAILABLE error. A value equal to Long.MAX_VALUE is considered to mean that unavailability is permanent.

param
available The new available date/time

public voidsetJspFile(java.lang.String jspFile)
Set the context-relative URI of the JSP file for this servlet.

param
jspFile JSP file URI

public voidsetLoadOnStartup(int value)
Set the load-on-startup order value (negative value means load on first call).

param
value New load-on-startup value

public voidsetRunAs(java.lang.String runAs)
Set the run-as identity for this servlet.

param
value New run-as identity value

public voidsetServletClass(java.lang.String servletClass)
Set the fully qualified servlet class name for this servlet.

param
servletClass Servlet class name

public voidunavailable(javax.servlet.UnavailableException unavailable)
Process an UnavailableException, marking this servlet as unavailable for the specified amount of time.

param
unavailable The exception that occurred, or null to mark this servlet as permanently unavailable

public voidunload()
Unload all initialized instances of this servlet, after calling the destroy() method for each instance. This can be used, for example, prior to shutting down the entire servlet engine, or prior to reloading all of the classes from the Loader associated with our Loader's repository.

exception
ServletException if an unload error occurs