Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Licensed to the Apache Software Foundation (ASF) under one or more
   * contributor license agreements.  See the NOTICE file distributed with
   * this work for additional information regarding copyright ownership.
   * The ASF licenses this file to You under the Apache License, Version 2.0
   * (the "License"); you may not use this file except in compliance with
   * the License.  You may obtain a copy of the License at
   * 
   *      http://www.apache.org/licenses/LICENSE-2.0
  * 
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 
 
 package org.apache.catalina;
 
 
 import java.util.Set;
 
 
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(s):
Craig R. McClanahan
Version:
$Revision: 1240 $ $Date: 2009-11-04 23:25:59 +0100 (Wed, 04 Nov 2009) $
 
 
 public interface Wrapper extends Container {
 
 
     // ------------------------------------------------------------- Properties
 

    
Return the async supported value.
 
     public boolean getAsyncSupported();


    
Set the async supported value.

Parameters:
value New async supported value
 
     public void setAsyncSupported(boolean asyncSupported);


    
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 long getAvailable();


    
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.

Parameters:
available The new available date/time
 
     public void setAvailable(long available);


    
Return the Servlet description.
    public String getDescription();


    
Set the description.
    public void setDescription(String description);


    
Get the flag that indicates if the wrapper was added programmatically. The flag value defaults to false.
    public boolean isDynamic();


    
Set a flag that indicates if the wrapper was added programmatically.

Parameters:
value New async supported value
    public void setDynamic(boolean dynamic);


    
Return the enabled value.
    public boolean getEnabled();


    
Set the enabled value.

Parameters:
value New async supported value
    public void setEnabled(boolean enabled);


    
Return the InstanceSupport object for this Wrapper instance.
    public InstanceSupport getInstanceSupport();
    
    
    
Return the context-relative URI of the JSP file for this servlet.
    public String getJspFile();


    
Set the context-relative URI of the JSP file for this servlet.

Parameters:
jspFile JSP file URI
    public void setJspFile(String jspFile);


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


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

Parameters:
value New load-on-startup value
    public void setLoadOnStartup(int value);

    
    
Multipart configuration for this Servlet.
    public Multipart getMultipartConfig();
    

    
Set the multipart configuration for this Servlet.
    public void setMultipartConfig(Multipart multipartConfig);
    

    
Return the run-as identity for this servlet.
    public String getRunAs();


    
Set the run-as identity for this servlet.

Parameters:
runAs New run-as identity value
    public void setRunAs(String runAs);


    
Return the fully qualified servlet class name for this servlet.
    public String getServletClass();


    
Set the fully qualified servlet class name for this servlet.

Parameters:
servletClass Servlet class name
    public void setServletClass(String servletClass);


    
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.

Returns:
Array of names of the methods supported by the underlying servlet
    public String[] getServletMethods() throws ServletException;


    
Is this servlet currently unavailable?
    public boolean isUnavailable();
    // --------------------------------------------------------- Public Methods


    
Add a new servlet initialization parameter for this servlet.

Parameters:
name Name of this initialization parameter to add
value Value of this initialization parameter to add
    public void addInitParameter(String nameString value);


    
Add a new listener interested in InstanceEvents.

Parameters:
listener The new listener
    public void addInstanceListener(InstanceListener listener);


    
Add a mapping associated with the Wrapper.

Parameters:
mapping The new wrapper mapping
    public void addMapping(String mapping);


    
Add a new security role reference record to the set of records for this servlet.

Parameters:
name Role name used within this servlet
link Role name used within the web application
    public void addSecurityReference(String nameString link);


    
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().

Throws:
javax.servlet.ServletException if the servlet init() method threw an exception
javax.servlet.ServletException if a loading error occurs
    public Servlet allocate() 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.

Parameters:
servlet The servlet to be returned
Throws:
javax.servlet.ServletException if a deallocation error occurs
    public void deallocate(Servlet servletthrows ServletException;


    
Get the facade ServletRegistration.
    public ServletRegistration getFacade();
    
    
    
Return the associated servlet instance.
    public Servlet getServlet();
    
    
    
Set the associated servlet instance. This will only do something meaningful for non STM servlets.
    public void setServlet(Servlet servlet);
    
    
    
Return the value for the specified initialization parameter name, if any; otherwise return null.

Parameters:
name Name of the requested initialization parameter
    public String findInitParameter(String name);


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


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


    
Return the security role link for the specified security role reference name, if any; otherwise return null.

Parameters:
name Security role reference used within this servlet
    public String findSecurityReference(String name);


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


    
Increment the error count value used when monitoring.
    public void incrementErrorCount();


    
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.

Throws:
javax.servlet.ServletException if the servlet init() method threw an exception
javax.servlet.ServletException if some other loading problem occurs
    public void load() throws ServletException;


    
Remove the specified initialization parameter from this servlet.

Parameters:
name Name of the initialization parameter to remove
    public void removeInitParameter(String name);


    
Remove a listener no longer interested in InstanceEvents.

Parameters:
listener The listener to remove
    public void removeInstanceListener(InstanceListener listener);


    
Remove a mapping associated with the wrapper.

Parameters:
mapping The pattern to remove
    public void removeMapping(String mapping);


    
Remove any security role reference for the specified role name.

Parameters:
name Security role used within this servlet to be removed
    public void removeSecurityReference(String name);


    
Process an UnavailableException, marking this servlet as unavailable for the specified amount of time.

Parameters:
unavailable The exception that occurred, or null to mark this servlet as permanently unavailable
    public void unavailable(UnavailableException unavailable);


    
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.

Throws:
javax.servlet.ServletException if an unload error occurs
    public void unload() throws ServletException;

    
    
Set an associated ServletSecurity.

Returns:
the set of patterns for which the servlet security will not be defined
    public Set<StringsetServletSecurity(ServletSecurityElement servletSecurity);

    
    
Get an associated ServletSecurity, if any.
New to GrepCode? Check out our FAQ X