com.bradmcevoy.http
Class AbstractResponse

java.lang.Object
  extended by com.bradmcevoy.http.AbstractResponse
All Implemented Interfaces:
Response
Direct Known Subclasses:
DebugFilter.DebugResponse

public abstract class AbstractResponse
extends java.lang.Object
implements Response


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.bradmcevoy.http.Response
Response.CacheControlResponse, Response.ContentEncoding, Response.ContentType, Response.Header, Response.Status
 
Field Summary
protected  java.lang.Long contentLength
           
 
Fields inherited from interface com.bradmcevoy.http.Response
HTTP, IMAGE_JPG, MULTIPART, XML
 
Constructor Summary
AbstractResponse()
           
 
Method Summary
 void close()
           
 java.lang.Long getContentLength()
           
 java.lang.String getContentTypeHeader()
           
 java.lang.String getResponseHeader(Response.Header header)
           
 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)
           
protected  void setAnyDateHeader(Response.Header name, java.util.Date date)
           
 void setCacheControlMaxAgeHeader(java.lang.Long delta)
          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 delta)
           
 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 type)
           
 void setDateHeader(java.util.Date date)
           
 void setDavHeader(java.lang.String supportedLevels)
           
 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 s)
           
 void setResponseHeader(Response.Header header, java.lang.String value)
           
 void setVaryHeader(java.lang.String value)
          Sets the Vary response header, necessary for response compression
 void write(java.lang.String s)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.bradmcevoy.http.Response
getHeaders, getNonStandardHeader, getOutputStream, getStatus, setAuthenticateHeader, setCookie, setCookie, setNonStandardHeader, setStatus
 

Field Detail

contentLength

protected java.lang.Long contentLength
Constructor Detail

AbstractResponse

public AbstractResponse()
Method Detail

setResponseHeader

public void setResponseHeader(Response.Header header,
                              java.lang.String value)

getResponseHeader

public java.lang.String getResponseHeader(Response.Header header)

setContentEncodingHeader

public void setContentEncodingHeader(Response.ContentEncoding encoding)
Specified by:
setContentEncodingHeader in interface Response

getContentLength

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

setDateHeader

public void setDateHeader(java.util.Date date)
Specified by:
setDateHeader in interface Response

setContentRangeHeader

public void setContentRangeHeader(long start,
                                  long finish,
                                  java.lang.Long totalLength)
Specified by:
setContentRangeHeader in interface Response

setContentLengthHeader

public void setContentLengthHeader(java.lang.Long totalLength)
Specified by:
setContentLengthHeader in interface Response

setContentTypeHeader

public void setContentTypeHeader(java.lang.String type)
Specified by:
setContentTypeHeader in interface Response

getContentTypeHeader

public java.lang.String getContentTypeHeader()
Specified by:
getContentTypeHeader in interface Response

setCacheControlMaxAgeHeader

public void setCacheControlMaxAgeHeader(java.lang.Long delta)
Description copied from interface: Response
Set the cache control header to allow the resource to be cached for the given number of seconds

Specified by:
setCacheControlMaxAgeHeader in interface Response
Parameters:
delta - - must not be null

setCacheControlPrivateMaxAgeHeader

public void setCacheControlPrivateMaxAgeHeader(java.lang.Long delta)
Specified by:
setCacheControlPrivateMaxAgeHeader in interface Response

setExpiresHeader

public void setExpiresHeader(java.util.Date expiresAt)
Specified by:
setExpiresHeader in interface Response

setEtag

public void setEtag(java.lang.String uniqueId)
Specified by:
setEtag in interface Response

setLastModifiedHeader

public void setLastModifiedHeader(java.util.Date date)
Specified by:
setLastModifiedHeader in interface Response

setCacheControlNoCacheHeader

public void setCacheControlNoCacheHeader()
Description copied from interface: Response
Set the cache control header to indicate that the resource should not be cached

Specified by:
setCacheControlNoCacheHeader in interface Response

setLocationHeader

public void setLocationHeader(java.lang.String redirectUrl)
Specified by:
setLocationHeader in interface Response

setAllowHeader

public void setAllowHeader(java.util.List<java.lang.String> methodsAllowed)
Specified by:
setAllowHeader in interface Response

setLockTokenHeader

public void setLockTokenHeader(java.lang.String s)
Specified by:
setLockTokenHeader in interface Response

setDavHeader

public void setDavHeader(java.lang.String supportedLevels)
Specified by:
setDavHeader in interface Response

setVaryHeader

public void setVaryHeader(java.lang.String value)
Description copied from interface: Response
Sets the Vary response header, necessary for response compression

Specified by:
setVaryHeader in interface Response

close

public void close()
Specified by:
close in interface Response

sendRedirect

public void sendRedirect(java.lang.String url)
Description copied from interface: Response
Will set the status to moved_temporaruly and set the location header to the given url

Specified by:
sendRedirect in interface Response

write

public void write(java.lang.String s)

setAnyDateHeader

protected void setAnyDateHeader(Response.Header name,
                                java.util.Date date)


Copyright © 2011. All Rights Reserved.