public interface Response
| Modifier and Type | Interface and Description |
|---|---|
static class |
Response.CacheControlResponse |
static class |
Response.ContentEncoding |
static class |
Response.ContentType |
static interface |
Response.Entity |
static class |
Response.Header |
static class |
Response.Status |
| Modifier and Type | Field and Description |
|---|---|
static String |
HTTP |
static String |
IMAGE_JPG |
static String |
MULTIPART |
static String |
XML |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Called to indicate that the request is completed.
|
String |
getAcceptRanges() |
String |
getAccessControlAllowOrigin()
Used for CORS responses
|
Long |
getContentLength() |
String |
getContentTypeHeader() |
Response.Entity |
getEntity() |
Map<String,String> |
getHeaders() |
String |
getNonStandardHeader(String code) |
OutputStream |
getOutputStream() |
Response.Status |
getStatus() |
void |
sendError(Response.Status status,
String message)
Called by milton when an error occurs.
|
void |
sendRedirect(String url)
Will set the status to moved_temporaruly and set the location header
to the given url
|
void |
setAcceptRanges(String s) |
void |
setAccessControlAllowOrigin(String s) |
void |
setAllowHeader(List<String> methodsAllowed) |
void |
setAuthenticateHeader(List<String> challenges)
Must set multiple Authenticate headers, one for each challenge
This will usually be one each for basic, digest, ntlm, etc
Note that order might be significant to some clients, so should be
preserved.
|
void |
setCacheControlMaxAgeHeader(Long deltaSeconds)
Set the cache control header to allow the resource to be cached
for the given number of seconds
|
void |
setCacheControlNoCacheHeader()
Set the cache control header to indicate that the resource should not
be cached
|
void |
setCacheControlPrivateMaxAgeHeader(Long deltaSeconds) |
void |
setContentEncodingHeader(Response.ContentEncoding encoding) |
void |
setContentLengthHeader(Long totalLength) |
void |
setContentRangeHeader(long start,
long finish,
Long totalLength) |
void |
setContentTypeHeader(String string) |
Cookie |
setCookie(Cookie cookie)
The
setCookie method is used to set a cookie value
with the cookie name. |
Cookie |
setCookie(String name,
String value)
The
setCookie method is used to set a cookie value
with the cookie name. |
void |
setDateHeader(Date date) |
void |
setDavHeader(String string) |
void |
setEntity(Response.Entity entity) |
void |
setEtag(String uniqueId) |
void |
setExpiresHeader(Date expiresAt) |
void |
setLastModifiedHeader(Date date) |
void |
setLocationHeader(String redirectUrl) |
void |
setLockTokenHeader(String tokenId) |
void |
setNonStandardHeader(String code,
String value) |
void |
setStatus(Response.Status status) |
void |
setVaryHeader(String string)
Sets the Vary response header, necessary for response compression
|
static final String HTTP
static final String IMAGE_JPG
static final String MULTIPART
static final String XML
Response.Status getStatus()
Long getContentLength()
void setContentEncodingHeader(Response.ContentEncoding encoding)
void setExpiresHeader(Date expiresAt)
void setLockTokenHeader(String tokenId)
void setAuthenticateHeader(List<String> challenges)
challenges - - a list of http authentication challengesvoid setStatus(Response.Status status)
void setEtag(String uniqueId)
void setContentRangeHeader(long start,
long finish,
Long totalLength)
void setContentLengthHeader(Long totalLength)
void setContentTypeHeader(String string)
String getContentTypeHeader()
Response.Entity getEntity()
void setEntity(Response.Entity entity)
void setCacheControlMaxAgeHeader(Long deltaSeconds)
deltaSeconds - - must not be nullvoid setCacheControlPrivateMaxAgeHeader(Long deltaSeconds)
void setCacheControlNoCacheHeader()
void setLastModifiedHeader(Date date)
void setDavHeader(String string)
OutputStream getOutputStream()
void setLocationHeader(String redirectUrl)
void setVaryHeader(String string)
string - void setDateHeader(Date date)
String getAccessControlAllowOrigin()
void setAccessControlAllowOrigin(String s)
String getAcceptRanges()
void setAcceptRanges(String s)
void close()
void sendError(Response.Status status, String message)
status - message - void sendRedirect(String url)
url - Cookie setCookie(Cookie cookie)
setCookie method is used to set a cookie value
with the cookie name. This will add a cookie to the response
stored under the name of the cookie, when this is committed it
will be added as a Set-Cookie header to the resulting response.cookie - this is the cookie to be added to the responseCookie setCookie(String name, String value)
setCookie method is used to set a cookie value
with the cookie name. This will add a cookie to the response
stored under the name of the cookie, when this is committed it
will be added as a Set-Cookie header to the resulting response.
This is a convenience method that avoids cookie creation.name - this is the cookie to be added to the responsevalue - this is the cookie value that is to be used