Top Description Inners Fields Constructors Methods
org.glassfish.grizzly.servlet

public Class HttpServletResponseImpl

extends Object
implements HttpServletResponse, ResponseHolder
Class Inheritance
All Implemented Interfaces
org.glassfish.grizzly.servlet.Holders.ResponseHolder, jakarta.servlet.http.HttpServletResponse, jakarta.servlet.ServletResponse
Imports
java.io.IOException, .PrintWriter, java.security.AccessController, .PrivilegedAction, .PrivilegedActionException, .PrivilegedExceptionAction, java.util.ArrayList, .Arrays, .Collection, .Locale, .Map, java.util.function.Supplier, java.util.logging.Level, .Logger, org.glassfish.grizzly.ThreadCache, org.glassfish.grizzly.http.server.Response, jakarta.servlet.ServletOutputStream, jakarta.servlet.http.Cookie, .HttpServletResponse

Facade class that wraps a Response object. All methods are delegated to the wrapped response.
Authors
Remy Maucherat, Jean-Francois Arcand
Version
$Revision: 1.9 $ $Date: 2007/05/05 05:32:43 $

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class

Field Summary

Modifier and TypeField and Description
private static final ThreadCache.CachedTypeIndex<HttpServletResponseImpl>
private static final Logger
private final ServletOutputStreamImpl
protected Response
response

The wrapped response.

protected HttpServletRequestImpl
protected boolean
usingOutputStream

Using output stream flag.

protected boolean
usingWriter

Using writer flag.

private ServletWriterImpl

Constructor Summary

AccessConstructor and Description
protected
HttpServletResponseImpl()

Construct a wrapper for the specified response.

Method Summary

Modifier and TypeMethod and Description
public void
addCookie(Cookie cookie)

Implements jakarta.servlet.http.HttpServletResponse.addCookie.

Adds the specified cookie to the response.

public void
addDateHeader(String name, long date)

Implements jakarta.servlet.http.HttpServletResponse.addDateHeader.

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

public void
addHeader(String name, String value)

Implements jakarta.servlet.http.HttpServletResponse.addHeader.

Adds a response header with the given name and value.

public void
addIntHeader(String name, int value)

Implements jakarta.servlet.http.HttpServletResponse.addIntHeader.

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

protected Object
clone()

Overrides java.lang.Object.clone.

Prevent cloning the facade.

public boolean
containsHeader(String name)

Implements jakarta.servlet.http.HttpServletResponse.containsHeader.

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

public static HttpServletResponseImpl
public String
encodeRedirectURL(String 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 url)

Implements jakarta.servlet.http.HttpServletResponse.encodeURL.

Encodes the specified URL by including the session ID, 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 String
getHeader(String string)

Implements jakarta.servlet.http.HttpServletResponse.getHeader.

Gets the value of the response header with the given name.

public Collection<String>
getHeaderNames()

Implements jakarta.servlet.http.HttpServletResponse.getHeaderNames.

Gets the names of the headers of this response.

public Collection<String>
getHeaders(String string)

Implements jakarta.servlet.http.HttpServletResponse.getHeaders.

Gets the values of the response header with the given name.

public Response
getInternalResponse()

Implements org.glassfish.grizzly.servlet.Holders.ResponseHolder.getInternalResponse.

Returns internal Grizzly Response associated with this Holder.

public Locale
getLocale()

Implements jakarta.servlet.ServletResponse.getLocale.

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

public String
public ServletOutputStream
getOutputStream()

Implements jakarta.servlet.ServletResponse.getOutputStream.

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

public Response
public int
getStatus()

Implements jakarta.servlet.http.HttpServletResponse.getStatus.

Gets the current status code of this response.

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

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

Gets the supplier of trailer headers.

public PrintWriter
getWriter()

Implements jakarta.servlet.ServletResponse.getWriter.

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

public void
initialize(final Response response, final HttpServletRequestImpl servletRequest)

public boolean
isCommitted()

Implements jakarta.servlet.ServletResponse.isCommitted.

Returns a boolean indicating if the response has been committed.

public boolean
pack-priv void
public void
reset()

Implements jakarta.servlet.ServletResponse.reset.

Clears any data that exists in the buffer as well as the status code, 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
sendEarlyHints()

Sends a 103 Early Hints interim response.

public void
sendError(int sc, String msg)

Implements jakarta.servlet.http.HttpServletResponse.sendError.

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

public void
sendError(int 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 location)

Overrides default 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
sendRedirect(String location, int sc, boolean clearBuffer)

Implements jakarta.servlet.http.HttpServletResponse.sendRedirect.

Sends a redirect response to the client using the specified redirect location URL and status code, optionally clears the response buffer and commits the response.

public void
setBufferSize(int size)

Implements jakarta.servlet.ServletResponse.setBufferSize.

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

public void
setCharacterEncoding(String charEnc)

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 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 len)

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 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 name, long date)

Implements jakarta.servlet.http.HttpServletResponse.setDateHeader.

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

public void
setHeader(String name, String value)

Implements jakarta.servlet.http.HttpServletResponse.setHeader.

Sets a response header with the given name and value.

public void
setIntHeader(String name, int value)

Implements jakarta.servlet.http.HttpServletResponse.setIntHeader.

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

public void
setLocale(Locale loc)

Implements jakarta.servlet.ServletResponse.setLocale.

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

public void
setStatus(int sc)

Implements jakarta.servlet.http.HttpServletResponse.setStatus.

Sets the status code for this response.

public void
setTrailerFields(final Supplier<Map<String, String>> supplier)

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

Sets the supplier of trailer headers.

Inherited from java.lang.Object:
equalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait