FileDocCategorySizeDatePackage
ApplicationResponse.javaAPI DocApache Tomcat 6.0.145385Fri Jul 20 04:20:32 BST 2007org.apache.catalina.core

ApplicationResponse

public class ApplicationResponse extends ServletResponseWrapper
Wrapper around a javax.servlet.ServletResponse that transforms an application response object (which might be the original one passed to a servlet, or might be based on the 2.3 javax.servlet.ServletResponseWrapper class) back into an internal org.apache.catalina.Response.

WARNING: Due to Java's lack of support for multiple inheritance, all of the logic in ApplicationResponse is duplicated in ApplicationHttpResponse. Make sure that you keep these two classes in synchronization when making changes!

author
Craig R. McClanahan
version
$Revision: 467222 $ $Date: 2006-10-24 05:17:11 +0200 (mar., 24 oct. 2006) $

Fields Summary
protected boolean
included
Is this wrapped response the subject of an include() call?
protected static org.apache.catalina.util.StringManager
sm
The string manager for this package.
Constructors Summary
public ApplicationResponse(ServletResponse response)
Construct a new wrapped response around the specified servlet response.

param
response The servlet response being wrapped


        this(response, false);

    
public ApplicationResponse(ServletResponse response, boolean included)
Construct a new wrapped response around the specified servlet response.

param
response The servlet response being wrapped
param
included true if this response is being processed by a RequestDispatcher.include() call


        super(response);
        setIncluded(included);

    
Methods Summary
booleanisIncluded()
Return the included flag for this response.


        return (this.included);

    
public voidreset()
Disallow reset() calls on a included response.

exception
IllegalStateException if the response has already been committed



    // ------------------------------------------------ ServletResponse Methods


                          
       

        // If already committed, the wrapped response will throw ISE
        if (!included || getResponse().isCommitted())
            getResponse().reset();

    
public voidsetBufferSize(int size)
Ignore setBufferSize() calls on an included response.

param
size The buffer size

        if (!included)
            getResponse().setBufferSize(size);
    
public voidsetContentLength(int len)
Disallow setContentLength() calls on an included response.

param
len The new content length


        if (!included)
            getResponse().setContentLength(len);

    
public voidsetContentType(java.lang.String type)
Disallow setContentType() calls on an included response.

param
type The new content type


        if (!included)
            getResponse().setContentType(type);

    
voidsetIncluded(boolean included)
Set the included flag for this response.

param
included The new included flag


        this.included = included;

    
public voidsetLocale(java.util.Locale loc)
Ignore setLocale() calls on an included response.

param
loc The new locale

        if (!included)
            getResponse().setLocale(loc);
    
public voidsetResponse(javax.servlet.ServletResponse response)
Set the response that we are wrapping.

param
response The new wrapped response


        super.setResponse(response);