Top Description Inners Fields Constructors Methods
org.apache.catalina.connector

public Class ResponseFacade

extends Object
implements HttpServletResponse
Class Inheritance
All Implemented Interfaces
jakarta.servlet.http.HttpServletResponse, jakarta.servlet.ServletResponse
Imports
java.io.IOException, .PrintWriter, java.security.AccessController, .PrivilegedAction, .PrivilegedActionException, .PrivilegedExceptionAction, java.util.Collection, .Locale, .Map, java.util.function.Supplier, jakarta.servlet.ServletOutputStream, jakarta.servlet.http.Cookie, .HttpServletResponse, org.apache.catalina.Globals, org.apache.catalina.security.SecurityUtil, org.apache.tomcat.util.res.StringManager

Facade class that wraps a Coyote response object. All methods are delegated to the wrapped response.
Author
Remy Maucherat

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
private static class
private class

Field Summary

Modifier and TypeField and Description
protected Response
response

The wrapped response.

protected static final StringManager
sm

The string manager for this package.

Constructor Summary

AccessConstructor and Description
public
ResponseFacade(Response
The response to be wrapped
response
)

Construct a wrapper for the specified response.

Method Summary

Modifier and TypeMethod and Description
public void
addCookie(Cookie
the Cookie to return to the client
cookie
)

Implements jakarta.servlet.http.HttpServletResponse.addCookie.

Adds the specified cookie to the response.

public void
addDateHeader(String
the name of the header to set
name
,
long
the additional date value
date
)

Implements jakarta.servlet.http.HttpServletResponse.addDateHeader.

Adds a response header with the given name and date-value.

public void
addHeader(String
the name of the header
name
,
String
the additional header value If it contains octet string, it should be encoded according to RFC 2047 (http://www.ietf.org/rfc/rfc2047.txt)
value
)

Implements jakarta.servlet.http.HttpServletResponse.addHeader.

Adds a response header with the given name and value.

public void
addIntHeader(String
the name of the header
name
,
int
the assigned integer value
value
)

Implements jakarta.servlet.http.HttpServletResponse.addIntHeader.

Adds a response header with the given name and integer value.

private void
checkCommitted(String messageKey)

private void
public void
clear()

Clear facade.

protected Object
clone()

Overrides java.lang.Object.clone.

Prevent cloning the facade.

public boolean
containsHeader(String
the header name
name
)

Implements jakarta.servlet.http.HttpServletResponse.containsHeader.

Returns a boolean indicating whether the named response header has already been set.

public String
encodeRedirectURL(String
the url to be encoded.
url
)

Implements jakarta.servlet.http.HttpServletResponse.encodeRedirectURL.

Encodes the specified URL for use in the sendRedirect method or, if encoding is not needed, returns the URL unchanged.

public String
encodeURL(String
the url to be encoded.
url
)

Implements jakarta.servlet.http.HttpServletResponse.encodeURL.

Encodes the specified URL by including the session ID in it, or, if encoding is not needed, returns the URL unchanged.

public void
public void
flushBuffer()

Implements jakarta.servlet.ServletResponse.flushBuffer.

Forces any content in the buffer to be written to the client.

public int
getBufferSize()

Implements jakarta.servlet.ServletResponse.getBufferSize.

Returns the actual buffer size used for the response.

public String
getCharacterEncoding()

Implements jakarta.servlet.ServletResponse.getCharacterEncoding.

Returns the name of the character encoding (MIME charset) used for the body sent in this response.

public String
getContentType()

Implements jakarta.servlet.ServletResponse.getContentType.

Returns the content type used for the MIME body sent in this response.

public long
public String
getHeader(String
Header name to look up
name
)

Implements jakarta.servlet.http.HttpServletResponse.getHeader.

Return the value for the specified header, or null if this header has not been set.

public Collection<String>
getHeaderNames()

Implements jakarta.servlet.http.HttpServletResponse.getHeaderNames.

Get the header names set for this HTTP response.

public Collection<String>
getHeaders(String
Header name to look up
name
)

Implements jakarta.servlet.http.HttpServletResponse.getHeaders.

Return a Collection of all the header values associated with the specified header name.

public Locale
getLocale()

Implements jakarta.servlet.ServletResponse.getLocale.

Returns the locale specified for this response using the setLocale method.

public ServletOutputStream
getOutputStream()

Implements jakarta.servlet.ServletResponse.getOutputStream.

Returns a ServletOutputStream suitable for writing binary data in the response.

public int
getStatus()

Implements jakarta.servlet.http.HttpServletResponse.getStatus.

Get the HTTP status code for this Response.

public Supplier<Map<String, String>>
getTrailerFields()

Overrides default jakarta.servlet.http.HttpServletResponse.getTrailerFields.

Obtain the supplier of the trailer headers.

public PrintWriter
getWriter()

Implements jakarta.servlet.ServletResponse.getWriter.

Returns a PrintWriter object that can send character text to the client.

public boolean
isCommitted()

Implements jakarta.servlet.ServletResponse.isCommitted.

Returns a boolean indicating if the response has been committed.

public boolean
public void
reset()

Implements jakarta.servlet.ServletResponse.reset.

Clears any data that exists in the buffer as well as the status code and headers.

public void
resetBuffer()

Implements jakarta.servlet.ServletResponse.resetBuffer.

Clears the content of the underlying buffer in the response without clearing headers or status code.

public void
sendError(int
the error status code
sc
,
String
the descriptive message
msg
)

Implements jakarta.servlet.http.HttpServletResponse.sendError.

Sends an error response to the client using the specified status code and clears the output buffer.

public void
sendError(int
the error status code
sc
)

Implements jakarta.servlet.http.HttpServletResponse.sendError.

Sends an error response to the client using the specified status code and clears the buffer.

public void
sendRedirect(String
the redirect location URL (may be absolute or relative)
location
)

Implements jakarta.servlet.http.HttpServletResponse.sendRedirect.

Sends a redirect response to the client using the specified redirect location URL with the status code SC_FOUND 302 (Found), clears the response buffer and commits the response.

public void
setBufferSize(int
the preferred buffer size
size
)

Implements jakarta.servlet.ServletResponse.setBufferSize.

Sets the preferred buffer size for the body of the response.

public void
setCharacterEncoding(String
a String specifying only the character set defined by IANA Character Sets (http://www.iana.org/assignments/character-sets)
encoding
)

Implements jakarta.servlet.ServletResponse.setCharacterEncoding.

Sets the character encoding (MIME charset) of the response being sent to the client, for example, to UTF-8.

public void
setContentLength(int
an integer specifying the length of the content being returned to the client; sets the Content-Length header
len
)

Implements jakarta.servlet.ServletResponse.setContentLength.

Sets the length of the content body in the response In HTTP servlets, this method sets the HTTP Content-Length header.

public void
setContentLengthLong(long
an integer specifying the length of the content being returned to the client; sets the Content-Length header
length
)

Implements jakarta.servlet.ServletResponse.setContentLengthLong.

Sets the length of the content body in the response In HTTP servlets, this method sets the HTTP Content-Length header.

public void
setContentType(String
a String specifying the MIME type of the content
type
)

Implements jakarta.servlet.ServletResponse.setContentType.

Sets the content type of the response being sent to the client, if the response has not been committed yet.

public void
setDateHeader(String
the name of the header to set
name
,
long
the assigned date value
date
)

Implements jakarta.servlet.http.HttpServletResponse.setDateHeader.

Sets a response header with the given name and date-value.

public void
setHeader(String
the name of the header
name
,
String
the header value If it contains octet string, it should be encoded according to RFC 2047 (http://www.ietf.org/rfc/rfc2047.txt)
value
)

Implements jakarta.servlet.http.HttpServletResponse.setHeader.

Sets a response header with the given name and value.

public void
setIntHeader(String
the name of the header
name
,
int
the assigned integer value
value
)

Implements jakarta.servlet.http.HttpServletResponse.setIntHeader.

Sets a response header with the given name and integer value.

public void
setLocale(Locale
the locale of the response
loc
)

Implements jakarta.servlet.ServletResponse.setLocale.

Sets the locale of the response, if the response has not been committed yet.

public void
setStatus(int
the status code
sc
)

Implements jakarta.servlet.http.HttpServletResponse.setStatus.

Sets the status code for this response.

public void
setTrailerFields(Supplier<Map<String, String>>
The supplier for the trailer headers
supplier
)

Overrides default jakarta.servlet.http.HttpServletResponse.setTrailerFields.

Configure the supplier of the trailer headers.

Inherited from java.lang.Object:
equalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait