HttpServletResponse, ServletResponsepublic class Response extends java.lang.Object implements HttpServletResponse
Response provides the implementation for HttpServletResponse.
| Modifier and Type | Class | Description |
|---|---|---|
static class |
Response.OutputType |
| Modifier and Type | Field | Description |
|---|---|---|
static java.lang.String |
HTTP_ONLY_COMMENT |
If this string is found within the comment of a cookie added with
addCookie(Cookie), then the cookie
will be set as HTTP ONLY. |
static java.lang.String |
SET_INCLUDE_HEADER_PREFIX |
If a header name starts with this string, the header (stripped of the prefix)
can be set during include using only
setHeader(String, String) or
addHeader(String, String). |
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 | Description |
|---|---|
Response(HttpChannel channel,
HttpOutput out) |
| Modifier and Type | Method | Description |
|---|---|---|
void |
addCookie(Cookie cookie) |
|
void |
addCookie(org.eclipse.jetty.http.HttpCookie cookie) |
|
void |
addDateHeader(java.lang.String name,
long date) |
|
void |
addHeader(java.lang.String name,
java.lang.String value) |
|
void |
addIntHeader(java.lang.String name,
int value) |
|
void |
addSetRFC2965Cookie(java.lang.String name,
java.lang.String value,
java.lang.String domain,
java.lang.String path,
long maxAge,
java.lang.String comment,
boolean isSecure,
boolean isHttpOnly,
int version) |
Format a set cookie value
|
void |
addSetRFC6265Cookie(java.lang.String name,
java.lang.String value,
java.lang.String domain,
java.lang.String path,
long maxAge,
boolean isSecure,
boolean isHttpOnly) |
Format a set cookie value by RFC6265
|
void |
closeOutput() |
|
boolean |
containsHeader(java.lang.String name) |
|
java.lang.String |
encodeRedirectUrl(java.lang.String url) |
Deprecated.
|
java.lang.String |
encodeRedirectURL(java.lang.String url) |
|
java.lang.String |
encodeUrl(java.lang.String url) |
Deprecated.
|
java.lang.String |
encodeURL(java.lang.String url) |
|
void |
flushBuffer() |
|
int |
getBufferSize() |
|
java.lang.String |
getCharacterEncoding() |
|
org.eclipse.jetty.http.MetaData.Response |
getCommittedMetaData() |
Get the MetaData.Response committed for this response.
|
long |
getContentCount() |
|
long |
getContentLength() |
|
java.lang.String |
getContentType() |
|
java.lang.String |
getHeader(java.lang.String name) |
|
java.util.Collection<java.lang.String> |
getHeaderNames() |
|
java.util.Collection<java.lang.String> |
getHeaders(java.lang.String name) |
|
HttpChannel |
getHttpChannel() |
|
org.eclipse.jetty.http.HttpFields |
getHttpFields() |
|
HttpOutput |
getHttpOutput() |
|
java.util.Locale |
getLocale() |
|
long |
getLongContentLength() |
|
ServletOutputStream |
getOutputStream() |
|
java.lang.String |
getReason() |
|
int |
getStatus() |
|
java.util.function.Supplier<org.eclipse.jetty.http.HttpFields> |
getTrailers() |
|
java.io.PrintWriter |
getWriter() |
|
void |
include() |
|
void |
included() |
|
boolean |
isAllContentWritten(long written) |
|
boolean |
isCommitted() |
|
boolean |
isContentComplete(long written) |
|
boolean |
isIncluding() |
|
boolean |
isWriting() |
|
protected org.eclipse.jetty.http.MetaData.Response |
newResponseMetaData() |
|
static void |
putHeaders(HttpServletResponse response,
org.eclipse.jetty.http.HttpContent content,
long contentLength,
boolean etag) |
|
void |
putHeaders(org.eclipse.jetty.http.HttpContent content,
long contentLength,
boolean etag) |
|
protected void |
recycle() |
|
void |
reset() |
|
void |
reset(boolean preserveCookies) |
|
void |
resetBuffer() |
|
void |
resetForForward() |
|
void |
sendError(int sc) |
|
void |
sendError(int code,
java.lang.String message) |
|
void |
sendProcessing() |
Sends a 102-Processing response.
|
void |
sendRedirect(int code,
java.lang.String location) |
Sends a response with one of the 300 series redirection codes.
|
void |
sendRedirect(java.lang.String location) |
|
void |
setBufferSize(int size) |
|
void |
setCharacterEncoding(java.lang.String encoding) |
|
void |
setContentLength(int len) |
|
void |
setContentLengthLong(long length) |
|
void |
setContentType(java.lang.String contentType) |
|
void |
setDateHeader(java.lang.String name,
long date) |
|
void |
setHeader(java.lang.String name,
java.lang.String value) |
|
void |
setHeader(org.eclipse.jetty.http.HttpHeader name,
java.lang.String value) |
|
void |
setIntHeader(java.lang.String name,
int value) |
|
void |
setLocale(java.util.Locale locale) |
|
void |
setLongContentLength(long len) |
|
void |
setStatus(int sc) |
|
void |
setStatus(int sc,
java.lang.String sm) |
Deprecated.
|
void |
setStatusWithReason(int sc,
java.lang.String sm) |
|
void |
setTrailers(java.util.function.Supplier<org.eclipse.jetty.http.HttpFields> trailers) |
|
java.lang.String |
toString() |
public static final java.lang.String SET_INCLUDE_HEADER_PREFIX
setHeader(String, String) or
addHeader(String, String).public static final java.lang.String HTTP_ONLY_COMMENT
addCookie(Cookie), then the cookie
will be set as HTTP ONLY.public Response(HttpChannel channel, HttpOutput out)
public HttpChannel getHttpChannel()
protected void recycle()
public HttpOutput getHttpOutput()
public boolean isIncluding()
public void include()
public void included()
public void addCookie(org.eclipse.jetty.http.HttpCookie cookie)
public void addCookie(Cookie cookie)
addCookie in interface HttpServletResponsepublic void addSetRFC6265Cookie(java.lang.String name,
java.lang.String value,
java.lang.String domain,
java.lang.String path,
long maxAge,
boolean isSecure,
boolean isHttpOnly)
name - the namevalue - the valuedomain - the domainpath - the pathmaxAge - the maximum ageisSecure - true if secure cookieisHttpOnly - true if for http onlypublic void addSetRFC2965Cookie(java.lang.String name,
java.lang.String value,
java.lang.String domain,
java.lang.String path,
long maxAge,
java.lang.String comment,
boolean isSecure,
boolean isHttpOnly,
int version)
name - the namevalue - the valuedomain - the domainpath - the pathmaxAge - the maximum agecomment - the comment (only present on versions > 0)isSecure - true if secure cookieisHttpOnly - true if for http onlyversion - version of cookie logic to use (0 == default behavior)public boolean containsHeader(java.lang.String name)
containsHeader in interface HttpServletResponsepublic java.lang.String encodeURL(java.lang.String url)
encodeURL in interface HttpServletResponsepublic java.lang.String encodeRedirectURL(java.lang.String url)
encodeRedirectURL in interface HttpServletResponse@Deprecated public java.lang.String encodeUrl(java.lang.String url)
encodeUrl in interface HttpServletResponse@Deprecated public java.lang.String encodeRedirectUrl(java.lang.String url)
encodeRedirectUrl in interface HttpServletResponsepublic void sendError(int sc)
throws java.io.IOException
sendError in interface HttpServletResponsejava.io.IOExceptionpublic void sendError(int code,
java.lang.String message)
throws java.io.IOException
sendError in interface HttpServletResponsejava.io.IOExceptionpublic void sendProcessing()
throws java.io.IOException
java.io.IOException - if unable to send the 102 responseHttpServletResponse.sendError(int)public void sendRedirect(int code,
java.lang.String location)
throws java.io.IOException
code - the redirect status codelocation - the location to send in Location headersjava.io.IOException - if unable to send the redirectpublic void sendRedirect(java.lang.String location)
throws java.io.IOException
sendRedirect in interface HttpServletResponsejava.io.IOExceptionpublic void setDateHeader(java.lang.String name,
long date)
setDateHeader in interface HttpServletResponsepublic void addDateHeader(java.lang.String name,
long date)
addDateHeader in interface HttpServletResponsepublic void setHeader(org.eclipse.jetty.http.HttpHeader name,
java.lang.String value)
public void setHeader(java.lang.String name,
java.lang.String value)
setHeader in interface HttpServletResponsepublic java.util.Collection<java.lang.String> getHeaderNames()
getHeaderNames in interface HttpServletResponsepublic java.lang.String getHeader(java.lang.String name)
getHeader in interface HttpServletResponsepublic java.util.Collection<java.lang.String> getHeaders(java.lang.String name)
getHeaders in interface HttpServletResponsepublic void addHeader(java.lang.String name,
java.lang.String value)
addHeader in interface HttpServletResponsepublic void setIntHeader(java.lang.String name,
int value)
setIntHeader in interface HttpServletResponsepublic void addIntHeader(java.lang.String name,
int value)
addIntHeader in interface HttpServletResponsepublic void setStatus(int sc)
setStatus in interface HttpServletResponse@Deprecated
public void setStatus(int sc,
java.lang.String sm)
setStatus in interface HttpServletResponsepublic void setStatusWithReason(int sc,
java.lang.String sm)
public java.lang.String getCharacterEncoding()
getCharacterEncoding in interface ServletResponsepublic java.lang.String getContentType()
getContentType in interface ServletResponsepublic ServletOutputStream getOutputStream() throws java.io.IOException
getOutputStream in interface ServletResponsejava.io.IOExceptionpublic boolean isWriting()
public java.io.PrintWriter getWriter()
throws java.io.IOException
getWriter in interface ServletResponsejava.io.IOExceptionpublic void setContentLength(int len)
setContentLength in interface ServletResponsepublic long getContentLength()
public boolean isAllContentWritten(long written)
public boolean isContentComplete(long written)
public void closeOutput()
throws java.io.IOException
java.io.IOExceptionpublic long getLongContentLength()
public void setLongContentLength(long len)
public void setContentLengthLong(long length)
setContentLengthLong in interface ServletResponsepublic void setCharacterEncoding(java.lang.String encoding)
setCharacterEncoding in interface ServletResponsepublic void setContentType(java.lang.String contentType)
setContentType in interface ServletResponsepublic void setBufferSize(int size)
setBufferSize in interface ServletResponsepublic int getBufferSize()
getBufferSize in interface ServletResponsepublic void flushBuffer()
throws java.io.IOException
flushBuffer in interface ServletResponsejava.io.IOExceptionpublic void reset()
reset in interface ServletResponsepublic void reset(boolean preserveCookies)
public void resetForForward()
public void resetBuffer()
resetBuffer in interface ServletResponsepublic void setTrailers(java.util.function.Supplier<org.eclipse.jetty.http.HttpFields> trailers)
public java.util.function.Supplier<org.eclipse.jetty.http.HttpFields> getTrailers()
protected org.eclipse.jetty.http.MetaData.Response newResponseMetaData()
public org.eclipse.jetty.http.MetaData.Response getCommittedMetaData()
newResponseMetaData()
if not yet committed.public boolean isCommitted()
isCommitted in interface ServletResponsepublic void setLocale(java.util.Locale locale)
setLocale in interface ServletResponsepublic java.util.Locale getLocale()
getLocale in interface ServletResponsepublic int getStatus()
getStatus in interface HttpServletResponsepublic java.lang.String getReason()
public org.eclipse.jetty.http.HttpFields getHttpFields()
public long getContentCount()
public java.lang.String toString()
toString in class java.lang.Objectpublic void putHeaders(org.eclipse.jetty.http.HttpContent content,
long contentLength,
boolean etag)
public static void putHeaders(HttpServletResponse response, org.eclipse.jetty.http.HttpContent content, long contentLength, boolean etag)
Copyright © 1995–2018 Webtide. All rights reserved.