Package io.milton.http
Interface Response
public interface Response
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumstatic enumstatic enumstatic interfacestatic enumstatic enum -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Called to indicate that the request is completed.Used for CORS responsesgetNonStandardHeader(String code) voidsendError(Response.Status status, String message) Called by milton when an error occurs.voidsendRedirect(String url) Will set the status to moved_temporaruly and set the location header to the given urlvoidvoidvoidsetAllowHeader(List<String> methodsAllowed) voidsetAuthenticateHeader(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.voidsetCacheControlMaxAgeHeader(Long deltaSeconds) Set the cache control header to allow the resource to be cached for the given number of secondsvoidSet the cache control header to indicate that the resource should not be cachedvoidsetCacheControlPrivateMaxAgeHeader(Long deltaSeconds) voidvoidsetContentLengthHeader(Long totalLength) voidsetContentRangeHeader(long start, long finish, Long totalLength) voidsetContentTypeHeader(String string) ThesetCookiemethod is used to set a cookie value with the cookie name.ThesetCookiemethod is used to set a cookie value with the cookie name.voidsetDateHeader(Date date) voidsetDavHeader(String string) voidsetEntity(Response.Entity entity) voidvoidsetExpiresHeader(Date expiresAt) voidsetLastModifiedHeader(Date date) voidsetLocationHeader(String redirectUrl) voidsetLockTokenHeader(String tokenId) voidsetNonStandardHeader(String code, String value) voidsetStatus(Response.Status status) voidsetVaryHeader(String string) Sets the Vary response header, necessary for response compression
-
Field Details
-
HTTP
- See Also:
-
IMAGE_JPG
- See Also:
-
MULTIPART
- See Also:
-
XML
- See Also:
-
-
Method Details
-
getStatus
Response.Status getStatus() -
getHeaders
-
getContentLength
Long getContentLength()- Returns:
- - the content length which might have been set by a handler, or null if none has been set
-
setContentEncodingHeader
-
setExpiresHeader
-
setLockTokenHeader
-
setAuthenticateHeader
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. ie list item zero should be first.- Parameters:
challenges- - a list of http authentication challenges
-
setStatus
-
setEtag
-
setContentRangeHeader
-
setContentLengthHeader
-
setContentTypeHeader
-
getContentTypeHeader
String getContentTypeHeader() -
getEntity
Response.Entity getEntity() -
setEntity
-
setCacheControlMaxAgeHeader
Set the cache control header to allow the resource to be cached for the given number of seconds- Parameters:
deltaSeconds- - must not be null
-
setCacheControlPrivateMaxAgeHeader
-
setCacheControlNoCacheHeader
void setCacheControlNoCacheHeader()Set the cache control header to indicate that the resource should not be cached -
setLastModifiedHeader
-
setDavHeader
-
setNonStandardHeader
-
getNonStandardHeader
-
setAllowHeader
-
getOutputStream
OutputStream getOutputStream() -
setLocationHeader
-
setVaryHeader
Sets the Vary response header, necessary for response compression- Parameters:
string-
-
setDateHeader
-
getAccessControlAllowOrigin
String getAccessControlAllowOrigin()Used for CORS responses- Returns:
-
setAccessControlAllowOrigin
-
getAcceptRanges
String getAcceptRanges() -
setAcceptRanges
-
close
void close()Called to indicate that the request is completed. Some response implementations might choose to close the http connection, while others which implement pipelining might not -
sendError
Called by milton when an error occurs. The underlying HTTP provider should choose to close the HTTP connection, because the amount of data already sent might not be consistent with the content length header which may have already been sent- Parameters:
status-message-
-
sendRedirect
Will set the status to moved_temporaruly and set the location header to the given url- Parameters:
url-
-
setCookie
ThesetCookiemethod 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.- Parameters:
cookie- this is the cookie to be added to the response- Returns:
- returns the cookie that has been set in the response
-
setCookie
ThesetCookiemethod 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.- Parameters:
name- this is the cookie to be added to the responsevalue- this is the cookie value that is to be used- Returns:
- returns the cookie that has been set in the response
-