Class Response
java.lang.Object
org.eclipse.jetty.ee8.nested.Response
- All Implemented Interfaces:
 javax.servlet.http.HttpServletResponse, javax.servlet.ServletResponse
- 
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classprotected static classstatic enum - 
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final StringString used in theCommentattribute ofCookieto support theHttpOnlyattribute.static final intprotected static final StringString used in theCommentattribute ofCookieto support thePartitionedattribute.protected static final StringThe strings used in theCommentattribute ofCookieto support theSameSiteattribute.protected static final Stringprotected static final Stringprotected static final Stringstatic final StringIf a header name starts with this string, the header (stripped of the prefix) can be set during include using onlysetHeader(String, String)oraddHeader(String, String).static final intFields inherited from interface javax.servlet.http.HttpServletResponse
SC_ACCEPTED, SC_BAD_GATEWAY, SC_BAD_REQUEST, SC_CONFLICT, SC_CONTINUE, SC_CREATED, SC_EXPECTATION_FAILED, SC_FORBIDDEN, SC_FOUND, SC_GATEWAY_TIMEOUT, SC_GONE, SC_HTTP_VERSION_NOT_SUPPORTED, SC_INTERNAL_SERVER_ERROR, SC_LENGTH_REQUIRED, SC_METHOD_NOT_ALLOWED, SC_MOVED_PERMANENTLY, SC_MOVED_TEMPORARILY, SC_MULTIPLE_CHOICES, SC_NO_CONTENT, SC_NON_AUTHORITATIVE_INFORMATION, SC_NOT_ACCEPTABLE, SC_NOT_FOUND, SC_NOT_IMPLEMENTED, SC_NOT_MODIFIED, SC_OK, SC_PARTIAL_CONTENT, SC_PAYMENT_REQUIRED, SC_PRECONDITION_FAILED, SC_PROXY_AUTHENTICATION_REQUIRED, SC_REQUEST_ENTITY_TOO_LARGE, SC_REQUEST_TIMEOUT, SC_REQUEST_URI_TOO_LONG, SC_REQUESTED_RANGE_NOT_SATISFIABLE, SC_RESET_CONTENT, SC_SEE_OTHER, SC_SERVICE_UNAVAILABLE, SC_SWITCHING_PROTOCOLS, SC_TEMPORARY_REDIRECT, SC_UNAUTHORIZED, SC_UNSUPPORTED_MEDIA_TYPE, SC_USE_PROXY - 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionvoidaddCookie(javax.servlet.http.Cookie cookie) voidaddCookie(HttpCookie cookie) voidaddDateHeader(String name, long date) voidvoidaddIntHeader(String name, int value) voidvoidDeprecated.voidcompleteOutput(Callback callback) booleancontainsHeader(String name) encodeRedirectUrl(String url) Deprecated.encodeRedirectURL(String url) Deprecated.voidvoidstatic ResponsegetBaseResponse(javax.servlet.ServletResponse servletResponse) intlonglonggetHeaders(String name) longjavax.servlet.ServletOutputStreamintvoidinclude()voidincluded()booleanisAllContentWritten(long written) booleanbooleanisContentComplete(long written) booleanbooleanbooleanbooleanprotected MetaData.Responseprotected voidonResponse(HttpFields.Mutable headers) static voidputHeaders(javax.servlet.http.HttpServletResponse response, HttpContent content, long contentLength, boolean etag) voidputHeaders(HttpContent content, long contentLength, boolean etag) protected voidrecycle()voidreopen()voidreplaceCookie(HttpCookie cookie) Replace (or add) a cookie.voidreset()voidvoidvoidvoidSends a 103 Early Hints interim response, as per RFC8297.voidsendError(int sc) voidSend an error response.voidSends a 102 Processing interim response.voidsendRedirect(int code, String location) Sends a response with one of the 300 series redirection codes.voidsendRedirect(int code, String location, boolean consumeAll) Sends a response with a given redirection code.voidsendRedirect(String location) voidsendRedirect(String location, boolean consumeAll) Sends a response with a HTTP version appropriate 30x redirection.voidsetBufferSize(int size) voidsetCharacterEncoding(String encoding) voidsetContentLength(int len) voidsetContentLengthLong(long length) voidsetContentType(String contentType) voidsetDateHeader(String name, long date) voidvoidsetHeader(HttpHeader name, String value) voidsetIntHeader(String name, int value) voidvoidsetLongContentLength(long len) voidsetStatus(int sc) voidDeprecated.voidsetStatusWithReason(int sc, String message) voidsetTrailerFields(Supplier<Map<String, String>> trailers) voidsetTrailers(Supplier<HttpFields> trailers) toString()static javax.servlet.http.HttpServletResponseunwrap(javax.servlet.ServletResponse servletResponse)  
- 
Field Details
- 
NO_CONTENT_LENGTH
public static final int NO_CONTENT_LENGTH- See Also:
 
 - 
USE_KNOWN_CONTENT_LENGTH
public static final int USE_KNOWN_CONTENT_LENGTH- See Also:
 
 - 
HTTP_ONLY_COMMENT
String used in theCommentattribute ofCookieto support theHttpOnlyattribute.- See Also:
 
 - 
PARTITIONED_COMMENT
String used in theCommentattribute ofCookieto support thePartitionedattribute.- See Also:
 
 - 
SAME_SITE_COMMENT
The strings used in theCommentattribute ofCookieto support theSameSiteattribute.- See Also:
 
 - 
SAME_SITE_NONE_COMMENT
- See Also:
 
 - 
SAME_SITE_LAX_COMMENT
- See Also:
 
 - 
SAME_SITE_STRICT_COMMENT
- See Also:
 
 - 
SET_INCLUDE_HEADER_PREFIX
If a header name starts with this string, the header (stripped of the prefix) can be set during include using onlysetHeader(String, String)oraddHeader(String, String).- See Also:
 
 
 - 
 - 
Constructor Details
- 
Response
 
 - 
 - 
Method Details
- 
getBaseResponse
 - 
getHttpChannel
 - 
onResponse
 - 
recycle
protected void recycle() - 
getHttpOutput
 - 
reopen
public void reopen() - 
errorClose
public void errorClose() - 
isIncluding
public boolean isIncluding() - 
include
public void include() - 
included
public void included() - 
addCookie
 - 
addCookie
public void addCookie(javax.servlet.http.Cookie cookie) - Specified by:
 addCookiein interfacejavax.servlet.http.HttpServletResponse
 - 
replaceCookie
Replace (or add) a cookie. Using name, path and domain, look for a matching set-cookie header and replace it.- Parameters:
 cookie- The cookie to add/replace
 - 
containsHeader
- Specified by:
 containsHeaderin interfacejavax.servlet.http.HttpServletResponse
 - 
encodeURL
 - 
encodeRedirectURL
 - 
encodeUrl
Deprecated.- Specified by:
 encodeUrlin interfacejavax.servlet.http.HttpServletResponse
 - 
encodeRedirectUrl
Deprecated.- Specified by:
 encodeRedirectUrlin interfacejavax.servlet.http.HttpServletResponse
 - 
sendError
- Specified by:
 sendErrorin interfacejavax.servlet.http.HttpServletResponse- Throws:
 IOException
 - 
sendError
Send an error response.In addition to the servlet standard handling, this method supports some additional codes:
- 102
 - Send a partial PROCESSING response and allow additional responses
 - 103
 - Send a partial EARLY_HINT response as per RFC8297
 - -1
 - Abort the HttpChannel and close the connection/stream
 
- Specified by:
 sendErrorin interfacejavax.servlet.http.HttpServletResponse- Parameters:
 code- The error codemessage- The message- Throws:
 IOException- If an IO problem occurred sending the error response.
 - 
sendProcessing
Sends a 102 Processing interim response. This method is called bysendError(int)if it is passed status code 102.- Throws:
 IOException- if unable to send the 102 response- See Also:
 
 - 
sendEarlyHint
Sends a 103 Early Hints interim response, as per RFC8297. This method is called bysendError(int)if it is passed status code 103.- Throws:
 IOException- if unable to send the 103 response- See Also:
 
 - 
sendRedirect
Sends a response with one of the 300 series redirection codes.- Parameters:
 code- the redirect status codelocation- the location to send inLocationheaders- Throws:
 IOException- if unable to send the redirect
 - 
sendRedirect
Sends a response with a HTTP version appropriate 30x redirection.- Parameters:
 location- the location to send inLocationheadersconsumeAll- if True, consume any HTTP/1 request input before doing the redirection. If the input cannot be consumed without blocking, then add a `Connection: close` header to the response.- Throws:
 IOException- if unable to send the redirect
 - 
sendRedirect
Sends a response with a given redirection code.- Parameters:
 code- the redirect status codelocation- the location to send inLocationheadersconsumeAll- if True, consume any HTTP/1 request input before doing the redirection. If the input cannot be consumed without blocking, then add a `Connection: close` header to the response.- Throws:
 IOException- if unable to send the redirect
 - 
sendRedirect
- Specified by:
 sendRedirectin interfacejavax.servlet.http.HttpServletResponse- Throws:
 IOException
 - 
setDateHeader
- Specified by:
 setDateHeaderin interfacejavax.servlet.http.HttpServletResponse
 - 
addDateHeader
- Specified by:
 addDateHeaderin interfacejavax.servlet.http.HttpServletResponse
 - 
setHeader
 - 
setHeader
 - 
getHeaderNames
- Specified by:
 getHeaderNamesin interfacejavax.servlet.http.HttpServletResponse
 - 
getHeader
 - 
getHeaders
- Specified by:
 getHeadersin interfacejavax.servlet.http.HttpServletResponse
 - 
addHeader
 - 
setIntHeader
- Specified by:
 setIntHeaderin interfacejavax.servlet.http.HttpServletResponse
 - 
addIntHeader
- Specified by:
 addIntHeaderin interfacejavax.servlet.http.HttpServletResponse
 - 
setStatus
public void setStatus(int sc) - Specified by:
 setStatusin interfacejavax.servlet.http.HttpServletResponse
 - 
setStatus
Deprecated.- Specified by:
 setStatusin interfacejavax.servlet.http.HttpServletResponse
 - 
setStatusWithReason
 - 
getCharacterEncoding
- Specified by:
 getCharacterEncodingin interfacejavax.servlet.ServletResponse
 - 
getContentType
- Specified by:
 getContentTypein interfacejavax.servlet.ServletResponse
 - 
getOutputStream
- Specified by:
 getOutputStreamin interfacejavax.servlet.ServletResponse- Throws:
 IOException
 - 
isWriting
public boolean isWriting() - 
isStreaming
public boolean isStreaming() - 
isWritingOrStreaming
public boolean isWritingOrStreaming() - 
getWriter
- Specified by:
 getWriterin interfacejavax.servlet.ServletResponse- Throws:
 IOException
 - 
setContentLength
public void setContentLength(int len) - Specified by:
 setContentLengthin interfacejavax.servlet.ServletResponse
 - 
getContentLength
public long getContentLength() - 
isAllContentWritten
public boolean isAllContentWritten(long written)  - 
isContentComplete
public boolean isContentComplete(long written)  - 
closeOutput
- Throws:
 IOException
 - 
completeOutput
 - 
completeOutput
 - 
getLongContentLength
public long getLongContentLength() - 
setLongContentLength
public void setLongContentLength(long len)  - 
setContentLengthLong
public void setContentLengthLong(long length) - Specified by:
 setContentLengthLongin interfacejavax.servlet.ServletResponse
 - 
setCharacterEncoding
- Specified by:
 setCharacterEncodingin interfacejavax.servlet.ServletResponse
 - 
setContentType
- Specified by:
 setContentTypein interfacejavax.servlet.ServletResponse
 - 
setBufferSize
public void setBufferSize(int size) - Specified by:
 setBufferSizein interfacejavax.servlet.ServletResponse
 - 
getBufferSize
public int getBufferSize()- Specified by:
 getBufferSizein interfacejavax.servlet.ServletResponse
 - 
flushBuffer
- Specified by:
 flushBufferin interfacejavax.servlet.ServletResponse- Throws:
 IOException
 - 
reset
public void reset()- Specified by:
 resetin interfacejavax.servlet.ServletResponse
 - 
resetContent
public void resetContent() - 
resetForForward
public void resetForForward() - 
resetBuffer
public void resetBuffer()- Specified by:
 resetBufferin interfacejavax.servlet.ServletResponse
 - 
getTrailers
 - 
setTrailers
 - 
getTrailerFields
 - 
setTrailerFields
 - 
newResponseMetaData
 - 
isCommitted
public boolean isCommitted()- Specified by:
 isCommittedin interfacejavax.servlet.ServletResponse
 - 
setLocale
- Specified by:
 setLocalein interfacejavax.servlet.ServletResponse
 - 
getLocale
- Specified by:
 getLocalein interfacejavax.servlet.ServletResponse
 - 
getStatus
public int getStatus()- Specified by:
 getStatusin interfacejavax.servlet.http.HttpServletResponse
 - 
getReason
 - 
getHttpFields
 - 
getContentCount
public long getContentCount() - 
toString
 - 
putHeaders
 - 
putHeaders
public static void putHeaders(javax.servlet.http.HttpServletResponse response, HttpContent content, long contentLength, boolean etag)  - 
unwrap
public static javax.servlet.http.HttpServletResponse unwrap(javax.servlet.ServletResponse servletResponse)  
 - 
 
closeOutput()