Top Description Inners Fields Constructors Methods
org.eclipse.jetty.ee10.servlet

public Class ServletApiResponse

extends Object
implements HttpServletResponse
Class Inheritance
All Implemented Interfaces
jakarta.servlet.http.HttpServletResponse, jakarta.servlet.ServletResponse
Imports
java.io.IOException, .PrintWriter, java.util.Collection, .EnumSet, .Locale, .Map, java.util.concurrent.CompletableFuture, java.util.function.Supplier, jakarta.servlet.ServletOutputStream, jakarta.servlet.http.Cookie, .HttpServletResponse, org.eclipse.jetty.ee10.servlet.ServletContextHandler.ServletRequestInfo, .ServletContextHandler.ServletResponseInfo, org.eclipse.jetty.http.HttpCookie, .HttpFields, .HttpHeader, .HttpStatus, .HttpVersion, org.eclipse.jetty.io.WriteThroughWriter, org.eclipse.jetty.server.Request, .Response, org.eclipse.jetty.session.ManagedSession, .SessionManager, org.eclipse.jetty.util.Blocker, .Callback, .StringUtil

The Jetty implementation of the ee10 HttpServletResponse object. This provides the bridge from the Servlet HttpServletResponse to the Jetty Core Response via the ServletContextResponse.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class

Field Summary

Modifier and TypeField and Description
private final ServletChannel
private final ServletContextHandler.ServletRequestInfo
private final ServletContextHandler.ServletResponseInfo
private static final EnumSet<ServletContextResponse.EncodingFrom>
private static final int

Constructor Summary

AccessConstructor and Description
protected

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

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, or, if encoding is not needed, returns the URL unchanged.

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 long
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
the name of the response header whose value to return
name
)

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
the name of the response header whose values to return
name
)

Implements jakarta.servlet.http.HttpServletResponse.getHeaders.

Gets the values of the response header with the given 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 Response
getResponse()

Returns: The core Response associated with the API response.

public ServletChannel
public ServletContextHandler.ServletRequestInfo
public ServletContextHandler.ServletResponseInfo
getServletResponseInfo()

Returns: The ServletResponseInfo for the request as provided by ServletContextResponse when wrapped by the ServletContextHandler.

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 boolean
isCommitted()

Implements jakarta.servlet.ServletResponse.isCommitted.

Returns a boolean indicating if the response has been committed.

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
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 and clears the 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
location
)

Implements jakarta.servlet.http.HttpServletResponse.sendRedirect.

Sends a temporary redirect response to the client using the specified redirect location URL and clears the buffer.

public void
sendRedirect(int
the redirect status code
code
,
String
the location to send in Location headers
location
)

Sends a response with one of the 300 series redirection codes.

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) or null
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
a long specifying the length of the content being returned to the client; sets the Content-Length header
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
a String specifying the MIME type of the content or null
contentType
)

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 or {code @null}
locale
)

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 of trailer headers
trailers
)

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

Sets the supplier of trailer headers.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait