com.bradmcevoy.http
Interface Response

All Known Implementing Classes:
AbstractResponse, DebugFilter.DebugResponse

public interface Response


Nested Class Summary
static class Response.CacheControlResponse
           
static class Response.ContentEncoding
           
static class Response.ContentType
           
static class Response.Header
           
static class Response.Status
           
 
Field Summary
static java.lang.String HTTP
           
static java.lang.String IMAGE_JPG
           
static java.lang.String MULTIPART
           
static java.lang.String XML
           
 
Method Summary
 void close()
           
 java.lang.Long getContentLength()
           
 java.lang.String getContentTypeHeader()
           
 java.util.Map<java.lang.String,java.lang.String> getHeaders()
           
 java.lang.String getNonStandardHeader(java.lang.String code)
           
 java.io.OutputStream getOutputStream()
           
 Response.Status getStatus()
           
 void sendRedirect(java.lang.String url)
          Will set the status to moved_temporaruly and set the location header to the given url
 void setAllowHeader(java.util.List<java.lang.String> methodsAllowed)
           
 void setAuthenticateHeader(java.util.List<java.lang.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(java.lang.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(java.lang.Long deltaSeconds)
           
 void setContentEncodingHeader(Response.ContentEncoding encoding)
           
 void setContentLengthHeader(java.lang.Long totalLength)
           
 void setContentRangeHeader(long start, long finish, java.lang.Long totalLength)
           
 void setContentTypeHeader(java.lang.String string)
           
 Cookie setCookie(Cookie cookie)
          The setCookie method is used to set a cookie value with the cookie name.
 Cookie setCookie(java.lang.String name, java.lang.String value)
          The setCookie method is used to set a cookie value with the cookie name.
 void setDateHeader(java.util.Date date)
           
 void setDavHeader(java.lang.String string)
           
 void setEtag(java.lang.String uniqueId)
           
 void setExpiresHeader(java.util.Date expiresAt)
           
 void setLastModifiedHeader(java.util.Date date)
           
 void setLocationHeader(java.lang.String redirectUrl)
           
 void setLockTokenHeader(java.lang.String tokenId)
           
 void setNonStandardHeader(java.lang.String code, java.lang.String value)
           
 void setStatus(Response.Status status)
           
 void setVaryHeader(java.lang.String string)
          Sets the Vary response header, necessary for response compression
 

Field Detail

HTTP

static final java.lang.String HTTP
See Also:
Constant Field Values

IMAGE_JPG

static final java.lang.String IMAGE_JPG
See Also:
Constant Field Values

MULTIPART

static final java.lang.String MULTIPART
See Also:
Constant Field Values

XML

static final java.lang.String XML
See Also:
Constant Field Values
Method Detail

getStatus

Response.Status getStatus()

getHeaders

java.util.Map<java.lang.String,java.lang.String> getHeaders()

getContentLength

java.lang.Long getContentLength()
Returns:
- the content length which might have been set by a handler, or null if none has been set

setContentEncodingHeader

void setContentEncodingHeader(Response.ContentEncoding encoding)

setExpiresHeader

void setExpiresHeader(java.util.Date expiresAt)

setLockTokenHeader

void setLockTokenHeader(java.lang.String tokenId)

setAuthenticateHeader

void setAuthenticateHeader(java.util.List<java.lang.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. ie list item zero should be first.

Parameters:
challenges - - a list of http authentication challenges

setStatus

void setStatus(Response.Status status)

setEtag

void setEtag(java.lang.String uniqueId)

setContentRangeHeader

void setContentRangeHeader(long start,
                           long finish,
                           java.lang.Long totalLength)

setContentLengthHeader

void setContentLengthHeader(java.lang.Long totalLength)

setContentTypeHeader

void setContentTypeHeader(java.lang.String string)

getContentTypeHeader

java.lang.String getContentTypeHeader()

setCacheControlMaxAgeHeader

void setCacheControlMaxAgeHeader(java.lang.Long deltaSeconds)
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

void setCacheControlPrivateMaxAgeHeader(java.lang.Long deltaSeconds)

setCacheControlNoCacheHeader

void setCacheControlNoCacheHeader()
Set the cache control header to indicate that the resource should not be cached


setLastModifiedHeader

void setLastModifiedHeader(java.util.Date date)

setDavHeader

void setDavHeader(java.lang.String string)

setNonStandardHeader

void setNonStandardHeader(java.lang.String code,
                          java.lang.String value)

getNonStandardHeader

java.lang.String getNonStandardHeader(java.lang.String code)

setAllowHeader

void setAllowHeader(java.util.List<java.lang.String> methodsAllowed)

getOutputStream

java.io.OutputStream getOutputStream()

setLocationHeader

void setLocationHeader(java.lang.String redirectUrl)

setVaryHeader

void setVaryHeader(java.lang.String string)
Sets the Vary response header, necessary for response compression

Parameters:
string -

setDateHeader

void setDateHeader(java.util.Date date)

close

void close()

sendRedirect

void sendRedirect(java.lang.String url)
Will set the status to moved_temporaruly and set the location header to the given url

Parameters:
unencodedUrl -

setCookie

Cookie setCookie(Cookie cookie)
The 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.

Parameters:
cookie - this is the cookie to be added to the response
Returns:
returns the cookie that has been set in the response

setCookie

Cookie setCookie(java.lang.String name,
                 java.lang.String value)
The 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.

Parameters:
name - this is the cookie to be added to the response
value - this is the cookie value that is to be used
Returns:
returns the cookie that has been set in the response


Copyright © 2011. All Rights Reserved.