javax.servlet.http.HttpServletResponse
, javax.servlet.ServletResponse
public class Response
extends java.lang.Object
implements javax.servlet.http.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(javax.servlet.http.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 |
addSetCookie(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 |
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() |
|
javax.servlet.ServletOutputStream |
getOutputStream() |
|
java.lang.String |
getReason() |
|
int |
getStatus() |
|
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(javax.servlet.http.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) |
|
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(javax.servlet.http.Cookie cookie)
addCookie
in interface javax.servlet.http.HttpServletResponse
public void addSetCookie(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 javax.servlet.http.HttpServletResponse
public java.lang.String encodeURL(java.lang.String url)
encodeURL
in interface javax.servlet.http.HttpServletResponse
public java.lang.String encodeRedirectURL(java.lang.String url)
encodeRedirectURL
in interface javax.servlet.http.HttpServletResponse
@Deprecated public java.lang.String encodeUrl(java.lang.String url)
encodeUrl
in interface javax.servlet.http.HttpServletResponse
@Deprecated public java.lang.String encodeRedirectUrl(java.lang.String url)
encodeRedirectUrl
in interface javax.servlet.http.HttpServletResponse
public void sendError(int sc) throws java.io.IOException
sendError
in interface javax.servlet.http.HttpServletResponse
java.io.IOException
public void sendError(int code, java.lang.String message) throws java.io.IOException
sendError
in interface javax.servlet.http.HttpServletResponse
java.io.IOException
public 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 javax.servlet.http.HttpServletResponse
java.io.IOException
public void setDateHeader(java.lang.String name, long date)
setDateHeader
in interface javax.servlet.http.HttpServletResponse
public void addDateHeader(java.lang.String name, long date)
addDateHeader
in interface javax.servlet.http.HttpServletResponse
public 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 javax.servlet.http.HttpServletResponse
public java.util.Collection<java.lang.String> getHeaderNames()
getHeaderNames
in interface javax.servlet.http.HttpServletResponse
public java.lang.String getHeader(java.lang.String name)
getHeader
in interface javax.servlet.http.HttpServletResponse
public java.util.Collection<java.lang.String> getHeaders(java.lang.String name)
getHeaders
in interface javax.servlet.http.HttpServletResponse
public void addHeader(java.lang.String name, java.lang.String value)
addHeader
in interface javax.servlet.http.HttpServletResponse
public void setIntHeader(java.lang.String name, int value)
setIntHeader
in interface javax.servlet.http.HttpServletResponse
public void addIntHeader(java.lang.String name, int value)
addIntHeader
in interface javax.servlet.http.HttpServletResponse
public void setStatus(int sc)
setStatus
in interface javax.servlet.http.HttpServletResponse
@Deprecated public void setStatus(int sc, java.lang.String sm)
setStatus
in interface javax.servlet.http.HttpServletResponse
public void setStatusWithReason(int sc, java.lang.String sm)
public java.lang.String getCharacterEncoding()
getCharacterEncoding
in interface javax.servlet.ServletResponse
public java.lang.String getContentType()
getContentType
in interface javax.servlet.ServletResponse
public javax.servlet.ServletOutputStream getOutputStream() throws java.io.IOException
getOutputStream
in interface javax.servlet.ServletResponse
java.io.IOException
public boolean isWriting()
public java.io.PrintWriter getWriter() throws java.io.IOException
getWriter
in interface javax.servlet.ServletResponse
java.io.IOException
public void setContentLength(int len)
setContentLength
in interface javax.servlet.ServletResponse
public long getContentLength()
public boolean isAllContentWritten(long written)
public boolean isContentComplete(long written)
public void closeOutput() throws java.io.IOException
java.io.IOException
public long getLongContentLength()
public void setLongContentLength(long len)
public void setContentLengthLong(long length)
setContentLengthLong
in interface javax.servlet.ServletResponse
public void setCharacterEncoding(java.lang.String encoding)
setCharacterEncoding
in interface javax.servlet.ServletResponse
public void setContentType(java.lang.String contentType)
setContentType
in interface javax.servlet.ServletResponse
public void setBufferSize(int size)
setBufferSize
in interface javax.servlet.ServletResponse
public int getBufferSize()
getBufferSize
in interface javax.servlet.ServletResponse
public void flushBuffer() throws java.io.IOException
flushBuffer
in interface javax.servlet.ServletResponse
java.io.IOException
public void reset()
reset
in interface javax.servlet.ServletResponse
public void reset(boolean preserveCookies)
public void resetForForward()
public void resetBuffer()
resetBuffer
in interface javax.servlet.ServletResponse
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 javax.servlet.ServletResponse
public void setLocale(java.util.Locale locale)
setLocale
in interface javax.servlet.ServletResponse
public java.util.Locale getLocale()
getLocale
in interface javax.servlet.ServletResponse
public int getStatus()
getStatus
in interface javax.servlet.http.HttpServletResponse
public java.lang.String getReason()
public org.eclipse.jetty.http.HttpFields getHttpFields()
public long getContentCount()
public java.lang.String toString()
toString
in class java.lang.Object
public void putHeaders(org.eclipse.jetty.http.HttpContent content, long contentLength, boolean etag)
public static void putHeaders(javax.servlet.http.HttpServletResponse response, org.eclipse.jetty.http.HttpContent content, long contentLength, boolean etag)
Copyright © 1995–2018 Webtide. All rights reserved.