org.apache.abdera.protocol.server.context
Class AbstractResponseContext

java.lang.Object
  extended by org.apache.abdera.protocol.util.AbstractMessage
      extended by org.apache.abdera.protocol.util.AbstractResponse
          extended by org.apache.abdera.protocol.server.context.AbstractResponseContext
All Implemented Interfaces:
Message, Response, ResponseContext, ProtocolConstants
Direct Known Subclasses:
BaseResponseContext, SimpleResponseContext

public abstract class AbstractResponseContext
extends AbstractResponse
implements ResponseContext


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.abdera.protocol.Response
Response.ResponseType
 
Field Summary
protected  boolean binary
           
protected static String[] EMPTY
           
protected  Map<String,Object[]> headers
           
protected  int status
           
protected  String status_text
           
protected  Writer writer
           
 
Fields inherited from class org.apache.abdera.protocol.util.AbstractResponse
nocache_headers, private_headers, smax_age
 
Fields inherited from class org.apache.abdera.protocol.util.AbstractMessage
flags, max_age
 
Fields inherited from interface org.apache.abdera.protocol.util.ProtocolConstants
NOCACHE, NOSTORE, NOTRANSFORM, ONLYIFCACHED, PRIVATE, PROXYREVALIDATE, PUBLIC, REVALIDATE
 
Constructor Summary
AbstractResponseContext()
           
 
Method Summary
 ResponseContext addEncodedHeader(String name, String charset, String value)
          Add an RFC 2047 encoded header in the response
 ResponseContext addEncodedHeaders(String name, String charset, String... vals)
          Add an RFC 2047 encoded header in the response
 ResponseContext addHeader(String name, Object value)
          Add a header to the response
 ResponseContext addHeaders(String name, Object... vals)
          Add a header to the response
 String getCacheControl()
          Return the value of the Cache-Control header
 Date getDateHeader(String name)
          Return the value of a Date header
 String getHeader(String name)
          Get the value of the specified header
 String[] getHeaderNames()
          Return a listing of header names
 Map<String,Object[]> getHeaders()
           
 Object[] getHeaders(String name)
          Return multiple values for the specified header
 int getStatus()
          Get the specific response status code
 String getStatusText()
          Get the response status text
 boolean isBinary()
          True if the response contains a binary entity as opposed to a character based entity.
 ResponseContext removeHeader(String name)
          Remove the specified header from the response
 ResponseContext setAge(long age)
          Set the value of the Age header
 ResponseContext setAllow(String... methods)
          Specify the HTTP methods allowed
 ResponseContext setAllow(String method)
          Specify the HTTP methods allowed
 ResponseContext setBinary(boolean binary)
          True if the response contains a binary entity as opposed to a character based entity.
 ResponseContext setContentLanguage(String language)
          Set the value of the Content-Language header
 ResponseContext setContentLength(long length)
          Set the value of the Content-Length header
 ResponseContext setContentLocation(String uri)
          Set the value of the Content-Location header
 ResponseContext setContentType(String type)
          Set the value of the Content-Type header
 ResponseContext setContentType(String type, String charset)
          Set the value of the Content-Type header
 ResponseContext setEncodedHeader(String name, String charset, String... vals)
          Set an RFC 2047 encoded header in the response
 ResponseContext setEncodedHeader(String name, String charset, String value)
          Set an RFC 2047 encoded header in the response
 ResponseContext setEntityTag(org.apache.abdera.util.EntityTag etag)
          Set the value of the ETag header
 ResponseContext setEntityTag(String etag)
          Set the value of the ETag header
 ResponseContext setEscapedHeader(String name, CharUtils.Profile profile, String value)
          Set a pct-encoded header in the response
 ResponseContext setExpires(Date date)
          Set the value of the Expires header
 ResponseContext setHeader(String name, Object... vals)
          Set the value of a header in the response
 ResponseContext setHeader(String name, Object value)
          Set the value of a header in the response
 ResponseContext setLastModified(Date date)
          Set the value of the Last-Modified header
 ResponseContext setLocation(String uri)
          Set the value of the Location header
 ResponseContext setSlug(String slug)
          Set the value of the Slug header
 ResponseContext setStatus(int status)
          Set the response status code
 ResponseContext setStatusText(String text)
          Set the response status text
 ResponseContext setWriter(Writer writer)
          Set the Abdera Writer for this response.
 
Methods inherited from class org.apache.abdera.protocol.util.AbstractResponse
getAge, getAllow, getContentLength, getEntityTag, getExpires, getLastModified, getLocation, getNoCacheHeaders, getPrivateHeaders, getSMaxAge, getType, isMustRevalidate, isPrivate, isProxyRevalidate, isPublic, setMaxAge, setMustRevalidate, setNoCache, setNoCacheHeaders, setNoStore, setNoTransform, setPrivate, setPrivateHeaders, setProxyRevalidate, setPublic
 
Methods inherited from class org.apache.abdera.protocol.util.AbstractMessage
check, getContentLanguage, getContentLocation, getContentType, getDecodedHeader, getDecodedHeaders, getMaxAge, getSlug, isNoCache, isNoStore, isNoTransform, toggle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.abdera.protocol.server.ResponseContext
hasEntity, writeTo, writeTo, writeTo, writeTo
 
Methods inherited from interface org.apache.abdera.protocol.Response
getAge, getAllow, getContentLength, getEntityTag, getExpires, getLastModified, getLocation, getNoCacheHeaders, getPrivateHeaders, getSMaxAge, getType, isMustRevalidate, isPrivate, isProxyRevalidate, isPublic
 
Methods inherited from interface org.apache.abdera.protocol.Message
getContentLanguage, getContentLocation, getContentType, getDecodedHeader, getDecodedHeaders, getMaxAge, getSlug, isNoCache, isNoStore, isNoTransform
 

Field Detail

EMPTY

protected static final String[] EMPTY

status

protected int status

status_text

protected String status_text

writer

protected Writer writer

binary

protected boolean binary

headers

protected Map<String,Object[]> headers
Constructor Detail

AbstractResponseContext

public AbstractResponseContext()
Method Detail

setBinary

public ResponseContext setBinary(boolean binary)
Description copied from interface: ResponseContext
True if the response contains a binary entity as opposed to a character based entity. Default is false. If true, the AbderaServlet will pass in the OutputStream for writing out, if false, the AbderaServlet will pass in the Writer.

Specified by:
setBinary in interface ResponseContext

isBinary

public boolean isBinary()
Description copied from interface: ResponseContext
True if the response contains a binary entity as opposed to a character based entity. Default is false. If true, the AbderaServlet will pass in the OutputStream for writing out, if false, the AbderaServlet will pass in the Writer.

Specified by:
isBinary in interface ResponseContext

removeHeader

public ResponseContext removeHeader(String name)
Description copied from interface: ResponseContext
Remove the specified header from the response

Specified by:
removeHeader in interface ResponseContext

setEncodedHeader

public ResponseContext setEncodedHeader(String name,
                                        String charset,
                                        String value)
Description copied from interface: ResponseContext
Set an RFC 2047 encoded header in the response

Specified by:
setEncodedHeader in interface ResponseContext

setEncodedHeader

public ResponseContext setEncodedHeader(String name,
                                        String charset,
                                        String... vals)
Description copied from interface: ResponseContext
Set an RFC 2047 encoded header in the response

Specified by:
setEncodedHeader in interface ResponseContext

setEscapedHeader

public ResponseContext setEscapedHeader(String name,
                                        CharUtils.Profile profile,
                                        String value)
Description copied from interface: ResponseContext
Set a pct-encoded header in the response

Specified by:
setEscapedHeader in interface ResponseContext

setHeader

public ResponseContext setHeader(String name,
                                 Object value)
Description copied from interface: ResponseContext
Set the value of a header in the response

Specified by:
setHeader in interface ResponseContext

setHeader

public ResponseContext setHeader(String name,
                                 Object... vals)
Description copied from interface: ResponseContext
Set the value of a header in the response

Specified by:
setHeader in interface ResponseContext

addEncodedHeader

public ResponseContext addEncodedHeader(String name,
                                        String charset,
                                        String value)
Description copied from interface: ResponseContext
Add an RFC 2047 encoded header in the response

Specified by:
addEncodedHeader in interface ResponseContext

addEncodedHeaders

public ResponseContext addEncodedHeaders(String name,
                                         String charset,
                                         String... vals)
Description copied from interface: ResponseContext
Add an RFC 2047 encoded header in the response

Specified by:
addEncodedHeaders in interface ResponseContext

addHeader

public ResponseContext addHeader(String name,
                                 Object value)
Description copied from interface: ResponseContext
Add a header to the response

Specified by:
addHeader in interface ResponseContext

addHeaders

public ResponseContext addHeaders(String name,
                                  Object... vals)
Description copied from interface: ResponseContext
Add a header to the response

Specified by:
addHeaders in interface ResponseContext

getHeaders

public Map<String,Object[]> getHeaders()

getDateHeader

public Date getDateHeader(String name)
Description copied from interface: Message
Return the value of a Date header

Specified by:
getDateHeader in interface Message

getHeader

public String getHeader(String name)
Description copied from interface: Message
Get the value of the specified header

Specified by:
getHeader in interface Message

getHeaders

public Object[] getHeaders(String name)
Description copied from interface: Message
Return multiple values for the specified header

Specified by:
getHeaders in interface Message

getHeaderNames

public String[] getHeaderNames()
Description copied from interface: Message
Return a listing of header names

Specified by:
getHeaderNames in interface Message

getCacheControl

public String getCacheControl()
Description copied from interface: Message
Return the value of the Cache-Control header

Specified by:
getCacheControl in interface Message
Overrides:
getCacheControl in class AbstractMessage

setAge

public ResponseContext setAge(long age)
Description copied from interface: ResponseContext
Set the value of the Age header

Specified by:
setAge in interface ResponseContext

setContentLanguage

public ResponseContext setContentLanguage(String language)
Description copied from interface: ResponseContext
Set the value of the Content-Language header

Specified by:
setContentLanguage in interface ResponseContext

setContentLength

public ResponseContext setContentLength(long length)
Description copied from interface: ResponseContext
Set the value of the Content-Length header

Specified by:
setContentLength in interface ResponseContext

setContentLocation

public ResponseContext setContentLocation(String uri)
Description copied from interface: ResponseContext
Set the value of the Content-Location header

Specified by:
setContentLocation in interface ResponseContext

setSlug

public ResponseContext setSlug(String slug)
Description copied from interface: ResponseContext
Set the value of the Slug header

Specified by:
setSlug in interface ResponseContext

setContentType

public ResponseContext setContentType(String type)
Description copied from interface: ResponseContext
Set the value of the Content-Type header

Specified by:
setContentType in interface ResponseContext

setContentType

public ResponseContext setContentType(String type,
                                      String charset)
Description copied from interface: ResponseContext
Set the value of the Content-Type header

Specified by:
setContentType in interface ResponseContext

setEntityTag

public ResponseContext setEntityTag(String etag)
Description copied from interface: ResponseContext
Set the value of the ETag header

Specified by:
setEntityTag in interface ResponseContext

setEntityTag

public ResponseContext setEntityTag(org.apache.abdera.util.EntityTag etag)
Description copied from interface: ResponseContext
Set the value of the ETag header

Specified by:
setEntityTag in interface ResponseContext

setExpires

public ResponseContext setExpires(Date date)
Description copied from interface: ResponseContext
Set the value of the Expires header

Specified by:
setExpires in interface ResponseContext

setLastModified

public ResponseContext setLastModified(Date date)
Description copied from interface: ResponseContext
Set the value of the Last-Modified header

Specified by:
setLastModified in interface ResponseContext

setLocation

public ResponseContext setLocation(String uri)
Description copied from interface: ResponseContext
Set the value of the Location header

Specified by:
setLocation in interface ResponseContext

getStatus

public int getStatus()
Description copied from interface: Response
Get the specific response status code

Specified by:
getStatus in interface Response

setStatus

public ResponseContext setStatus(int status)
Description copied from interface: ResponseContext
Set the response status code

Specified by:
setStatus in interface ResponseContext

getStatusText

public String getStatusText()
Description copied from interface: Response
Get the response status text

Specified by:
getStatusText in interface Response

setStatusText

public ResponseContext setStatusText(String text)
Description copied from interface: ResponseContext
Set the response status text

Specified by:
setStatusText in interface ResponseContext

setAllow

public ResponseContext setAllow(String method)
Description copied from interface: ResponseContext
Specify the HTTP methods allowed

Specified by:
setAllow in interface ResponseContext

setAllow

public ResponseContext setAllow(String... methods)
Description copied from interface: ResponseContext
Specify the HTTP methods allowed

Specified by:
setAllow in interface ResponseContext

setWriter

public ResponseContext setWriter(Writer writer)
Description copied from interface: ResponseContext
Set the Abdera Writer for this response. This can be used to customize the serialization of the response

Specified by:
setWriter in interface ResponseContext


Copyright © 2006-2010 Apache Software Foundation. All Rights Reserved.