Home » apache-tomcat-6.0.26-src » org.apache » catalina » core » [javadoc | source]
org.apache.catalina.core
public class: StandardWrapper [javadoc | source]
java.lang.Object
   org.apache.catalina.core.ContainerBase
      org.apache.catalina.core.StandardWrapper

All Implemented Interfaces:
    ServletConfig, Wrapper, NotificationEmitter, Pipeline, Serializable, MBeanRegistration, Container, Lifecycle

Direct Known Subclasses:
    ExistingStandardWrapper

Standard implementation of the Wrapper interface that represents an individual servlet definition. No child Containers are allowed, and the parent Container must be a Context.
Field Summary
protected static  Log log     
protected static final  String[] DEFAULT_SERVLET_METHODS     
protected  long available    The date and time at which this servlet will become available (in milliseconds since the epoch), or zero if the servlet is available. If this value equals Long.MAX_VALUE, the unavailability of this servlet is considered permanent. 
protected  NotificationBroadcasterSupport broadcaster    The broadcaster that sends j2ee notifications. 
protected  AtomicInteger countAllocated    The count of allocations that are currently active (even if they are for the same instance, as will be true on a non-STM servlet). 
protected  StandardWrapperFacade facade    The facade associated with this wrapper. 
protected static final  String info    The descriptive information string for this implementation. 
protected  Servlet instance    The (single) initialized instance of this servlet. 
protected  InstanceSupport instanceSupport    The support object for our instance listeners. 
protected  String jspFile    The context-relative URI of the JSP file for this servlet. 
protected  int loadOnStartup    The load-on-startup order value (negative value means load on first call) for this servlet. 
protected  ArrayList mappings    Mappings associated with the wrapper. 
protected  HashMap parameters    The initialization parameters for this servlet, keyed by parameter name. 
protected  HashMap references    The security role references for this servlet, keyed by role name used in the servlet. The corresponding value is the role name of the web application itself. 
protected  String runAs    The run-as identity for this servlet. 
protected  long sequenceNumber    The notification sequence number. 
protected  String servletClass    The fully qualified servlet class name for this servlet. 
protected  boolean singleThreadModel    Does this servlet implement the SingleThreadModel interface? 
protected  boolean unloading    Are we unloading our servlet instance at the moment? 
protected  int maxInstances    Maximum number of STM instances. 
protected  int nInstances    Number of instances currently loaded for a STM servlet. 
protected  Stack instancePool    Stack containing the STM instances. 
protected  long unloadDelay    Wait time for servlet unload in ms. 
protected  boolean isJspServlet    True if this StandardWrapper is for the JspServlet 
protected  ObjectName jspMonitorON    The ObjectName of the JSP monitoring mbean 
protected  boolean swallowOutput    Should we swallow System.out 
protected  StandardWrapperValve swValve     
protected  long loadTime     
protected  int classLoadTime     
protected static  Class[] classType    Static class array used when the SecurityManager is turned on and Servlet.init is invoked. 
protected static  Class[] classTypeUsedInService    Static class array used when the SecurityManager is turned on and Servlet.service is invoked. 
protected static  Properties restrictedServlets    Restricted servlets (which can only be loaded by a privileged webapp). 
protected  MBeanNotificationInfo[] notificationInfo     
Fields inherited from org.apache.catalina.core.ContainerBase:
children,  backgroundProcessorDelay,  lifecycle,  listeners,  loader,  logger,  logName,  manager,  cluster,  name,  parent,  parentClassLoader,  pipeline,  realm,  resources,  sm,  started,  initialized,  startChildren,  support,  type,  domain,  suffix,  oname,  controller,  mserver
Constructor:
 public StandardWrapper() 
Method from org.apache.catalina.core.StandardWrapper Summary:
addChild,   addDefaultMapper,   addInitParameter,   addInstanceListener,   addMapping,   addNotificationListener,   addSecurityReference,   allocate,   backgroundProcess,   deallocate,   findInitParameter,   findInitParameters,   findMappingObject,   findMappings,   findSecurityReference,   findSecurityReferences,   getAllDeclaredMethods,   getAvailable,   getClassLoadTime,   getCountAllocated,   getEngineName,   getErrorCount,   getInfo,   getInitParameter,   getInitParameterNames,   getInstanceSupport,   getJspFile,   getLoadOnStartup,   getLoadOnStartupString,   getLoadTime,   getMaxInstances,   getMaxTime,   getMinTime,   getNotificationInfo,   getProcessingTime,   getRequestCount,   getRootCause,   getRunAs,   getServlet,   getServletClass,   getServletContext,   getServletMethods,   getServletName,   incrementErrorCount,   isContainerProvidedServlet,   isEventProvider,   isServletAllowed,   isSingleThreadModel,   isStateManageable,   isStatisticsProvider,   isUnavailable,   load,   loadServlet,   registerJMX,   removeInitParameter,   removeInstanceListener,   removeMapping,   removeNotificationListener,   removeNotificationListener,   removeSecurityReference,   setAvailable,   setErrorCount,   setJspFile,   setLoadOnStartup,   setLoadOnStartupString,   setLoadTime,   setMaxInstances,   setMaxTime,   setMinTime,   setParent,   setProcessingTime,   setRequestCount,   setRunAs,   setServletClass,   setServletName,   start,   stop,   toString,   unavailable,   unload
Methods from org.apache.catalina.core.ContainerBase:
addChild,   addContainerListener,   addLifecycleListener,   addPropertyChangeListener,   addValve,   backgroundProcess,   createObjectName,   destroy,   findChild,   findChildren,   findContainerListeners,   findLifecycleListeners,   fireContainerEvent,   getBackgroundProcessorDelay,   getBasic,   getChildren,   getCluster,   getContainerSuffix,   getDomain,   getFirst,   getInfo,   getJSR77Suffix,   getJmxName,   getLoader,   getLogger,   getManager,   getMappingObject,   getName,   getObjectName,   getParent,   getParentClassLoader,   getParentName,   getPipeline,   getRealm,   getResources,   getStartChildren,   getType,   getValveObjectNames,   getValves,   init,   invoke,   logName,   postDeregister,   postRegister,   preDeregister,   preRegister,   removeChild,   removeContainerListener,   removeLifecycleListener,   removePropertyChangeListener,   removeValve,   setBackgroundProcessorDelay,   setBasic,   setCluster,   setDomain,   setLoader,   setManager,   setName,   setParent,   setParentClassLoader,   setRealm,   setResources,   setStartChildren,   start,   stop,   threadStart,   threadStop
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.catalina.core.StandardWrapper Detail:
 public  void addChild(Container child) 
    Refuse to add a child Container, because Wrappers are the lowest level of the Container hierarchy.
 protected  void addDefaultMapper(String mapperClass) 
    Add a default Mapper implementation if none have been configured explicitly.
 public  void addInitParameter(String name,
    String value) 
    Add a new servlet initialization parameter for this servlet.
 public  void addInstanceListener(InstanceListener listener) 
    Add a new listener interested in InstanceEvents.
 public  void addMapping(String mapping) 
    Add a mapping associated with the Wrapper.
 public  void addNotificationListener(NotificationListener listener,
    NotificationFilter filter,
    Object object) throws IllegalArgumentException 
 public  void addSecurityReference(String name,
    String link) 
    Add a new security role reference record to the set of records for this servlet.
 public Servlet allocate() throws ServletException 
    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().
 public  void backgroundProcess() 
    Execute a periodic task, such as reloading, etc. This method will be invoked inside the classloading context of this container. Unexpected throwables will be caught and logged.
 public  void deallocate(Servlet servlet) throws ServletException 
    Return this previously allocated servlet to the pool of available instances. If this servlet class does not implement SingleThreadModel, no action is actually required.
 public String findInitParameter(String name) 
    Return the value for the specified initialization parameter name, if any; otherwise return null.
 public String[] findInitParameters() 
    Return the names of all defined initialization parameters for this servlet.
 public Wrapper findMappingObject() 
    FIXME: Fooling introspection ...
 public String[] findMappings() 
    Return the mappings associated with this wrapper.
 public String findSecurityReference(String name) 
    Return the security role link for the specified security role reference name, if any; otherwise return null.
 public String[] findSecurityReferences() 
    Return the set of security role reference names associated with this servlet, if any; otherwise return a zero-length array.
 protected Method[] getAllDeclaredMethods(Class c) 
 public long getAvailable() 
    Return the available date/time for this servlet, in milliseconds since the epoch. If this date/time is Long.MAX_VALUE, it is considered to mean that unavailability is permanent and any request for this servlet will return an SC_NOT_FOUND error. 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.
 public int getClassLoadTime() 
 public int getCountAllocated() 
    Return the number of active allocations of this servlet, even if they are all for the same instance (as will be true for servlets that do not implement SingleThreadModel.
 public String getEngineName() 
 public int getErrorCount() 
 public String getInfo() 
    Return descriptive information about this Container implementation and the corresponding version number, in the format <description>/<version>.
 public String getInitParameter(String name) 
    Return the initialization parameter value for the specified name, if any; otherwise return null.
 public Enumeration getInitParameterNames() 
    Return the set of initialization parameter names defined for this servlet. If none are defined, an empty Enumeration is returned.
 public InstanceSupport getInstanceSupport() 
    Return the InstanceSupport object for this Wrapper instance.
 public String getJspFile() 
    Return the context-relative URI of the JSP file for this servlet.
 public int getLoadOnStartup() 
    Return the load-on-startup order value (negative value means load on first call).
 public String getLoadOnStartupString() 
 public long getLoadTime() 
 public int getMaxInstances() 
    Return maximum number of instances that will be allocated when a single thread model servlet is used.
 public long getMaxTime() 
 public long getMinTime() 
 public MBeanNotificationInfo[] getNotificationInfo() 
 public long getProcessingTime() 
 public int getRequestCount() 
 public static Throwable getRootCause(ServletException e) 
    Extract the root cause from a servlet exception.
 public String getRunAs() 
    Return the run-as identity for this servlet.
 public Servlet getServlet() 
    Return the associated servlet instance.
 public String getServletClass() 
    Return the fully qualified servlet class name for this servlet.
 public ServletContext getServletContext() 
    Return the servlet context with which this servlet is associated.
 public String[] getServletMethods() throws ServletException 
    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.
 public String getServletName() 
    Return the name of this servlet.
 public  void incrementErrorCount() 
    Increment the error count used for monitoring.
 protected boolean isContainerProvidedServlet(String classname) 
    Return true if the specified class name represents a container provided servlet class that should be loaded by the server class loader.
 public boolean isEventProvider() 
 protected boolean isServletAllowed(Object servlet) 
    Return true if loading this servlet is allowed.
 public boolean isSingleThreadModel() 
    Return true if the servlet class represented by this component implements the SingleThreadModel interface.
 public boolean isStateManageable() 
 public boolean isStatisticsProvider() 
 public boolean isUnavailable() 
    Is this servlet currently unavailable?
 public synchronized  void load() throws ServletException 
    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.

    IMPLEMENTATION NOTE: Servlets whose classnames begin with org.apache.catalina. (so-called "container" servlets) are loaded by the same classloader that loaded this class, rather than the classloader for the current web application. This gives such classes access to Catalina internals, which are prevented for classes loaded for web applications.

 public synchronized Servlet loadServlet() throws ServletException 
    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.
 protected  void registerJMX(StandardContext ctx) 
 public  void removeInitParameter(String name) 
    Remove the specified initialization parameter from this servlet.
 public  void removeInstanceListener(InstanceListener listener) 
    Remove a listener no longer interested in InstanceEvents.
 public  void removeMapping(String mapping) 
    Remove a mapping associated with the wrapper.
 public  void removeNotificationListener(NotificationListener listener) throws ListenerNotFoundException 
    Remove a JMX-NotificationListener
 public  void removeNotificationListener(NotificationListener listener,
    NotificationFilter filter,
    Object object) throws ListenerNotFoundException 
 public  void removeSecurityReference(String name) 
    Remove any security role reference for the specified role name.
 public  void setAvailable(long available) 
    Set the available date/time for this servlet, in milliseconds since the epoch. If this date/time is Long.MAX_VALUE, it is considered to mean that unavailability is permanent and any request for this servlet will return an SC_NOT_FOUND error. If this date/time is in the future, any request for this servlet will return an SC_SERVICE_UNAVAILABLE error.
 public  void setErrorCount(int errorCount) 
 public  void setJspFile(String jspFile) 
    Set the context-relative URI of the JSP file for this servlet.
 public  void setLoadOnStartup(int value) 
    Set the load-on-startup order value (negative value means load on first call).
 public  void setLoadOnStartupString(String value) 
    Set the load-on-startup order value from a (possibly null) string. Per the specification, any missing or non-numeric value is converted to a zero, so that this servlet will still be loaded at startup time, but in an arbitrary order.
 public  void setLoadTime(long loadTime) 
 public  void setMaxInstances(int maxInstances) 
    Set the maximum number of instances that will be allocated when a single thread model servlet is used.
 public  void setMaxTime(long maxTime) 
 public  void setMinTime(long minTime) 
 public  void setParent(Container container) 
    Set the parent Container of this Wrapper, but only if it is a Context.
 public  void setProcessingTime(long processingTime) 
 public  void setRequestCount(int requestCount) 
 public  void setRunAs(String runAs) 
    Set the run-as identity for this servlet.
 public  void setServletClass(String servletClass) 
    Set the fully qualified servlet class name for this servlet.
 public  void setServletName(String name) 
    Set the name of this servlet. This is an alias for the normal Container.setName() method, and complements the getServletName() method required by the ServletConfig interface.
 public  void start() throws LifecycleException 
    Start this component, pre-loading the servlet if the load-on-startup value is set appropriately.
 public  void stop() throws LifecycleException 
    Stop this component, gracefully shutting down the servlet if it has been initialized.
 public String toString() 
    Return a String representation of this component.
 public  void unavailable(UnavailableException unavailable) 
    Process an UnavailableException, marking this servlet as unavailable for the specified amount of time.
 public synchronized  void unload() throws ServletException 
    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.