org.apache.abdera.protocol.client
Class AbstractClientResponse

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.client.AbstractClientResponse
All Implemented Interfaces:
ClientResponse, Message, Response, ProtocolConstants
Direct Known Subclasses:
CachedResponseBase, CommonsResponse

public abstract class AbstractClientResponse
extends AbstractResponse
implements ClientResponse

Abstract base class for a ClientResponse


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.abdera.protocol.Response
Response.ResponseType
 
Field Summary
protected  Abdera abdera
           
protected  InputStream in
           
protected  Date now
           
protected  Parser parser
           
protected  Date response_date
           
 
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
protected AbstractClientResponse(Abdera abdera)
           
 
Method Summary
 String getCharacterEncoding()
          Get the character set encoding specified by the server in the Content-Type header
 Date getDateHeader(String header)
          Return the named HTTP header as a java.util.Date
<T extends Element>
Document<T>
getDocument()
          Get the response payload as a parsed Abdera FOM Document
<T extends Element>
Document<T>
getDocument(Parser parser)
          Get the response payload as a parsed Abdera FOM Document using the specified parser
<T extends Element>
Document<T>
getDocument(ParserOptions options)
          Get the response payload as a parsed Abdera FOM Document using the specified parser options
<T extends Element>
Document<T>
getDocument(Parser parser, ParserOptions options)
          Get the response payload as a parsed Abdera FOM Document using the specified parser and parser options
 InputStream getInputStream()
          Get the response payload as an input stream
protected  Parser getParser()
           
 Reader getReader()
          Get the response payload as a reader (assumed UTF-8 charset)
 Reader getReader(String charset)
          Get the response payload as a reader using the specified charset
 Date getServerDate()
          Return the date returned by the server in the response
protected  Date initResponseDate()
           
protected  void parse_cc()
           
 void setInputStream(InputStream in)
          Set the response input stream (used internally by Abdera)
 
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, getCacheControl, 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.client.ClientResponse
getMethod, getUri, release
 
Methods inherited from interface org.apache.abdera.protocol.Response
getAge, getAllow, getContentLength, getEntityTag, getExpires, getLastModified, getLocation, getNoCacheHeaders, getPrivateHeaders, getSMaxAge, getStatus, getStatusText, getType, isMustRevalidate, isPrivate, isProxyRevalidate, isPublic
 
Methods inherited from interface org.apache.abdera.protocol.Message
getCacheControl, getContentLanguage, getContentLocation, getContentType, getDecodedHeader, getDecodedHeaders, getHeader, getHeaderNames, getHeaders, getMaxAge, getSlug, isNoCache, isNoStore, isNoTransform
 

Field Detail

abdera

protected final Abdera abdera

parser

protected final Parser parser

now

protected final Date now

in

protected InputStream in

response_date

protected Date response_date
Constructor Detail

AbstractClientResponse

protected AbstractClientResponse(Abdera abdera)
Method Detail

initResponseDate

protected Date initResponseDate()

getParser

protected Parser getParser()

getDocument

public <T extends Element> Document<T> getDocument()
                                        throws ParseException
Get the response payload as a parsed Abdera FOM Document

Specified by:
getDocument in interface ClientResponse
Throws:
ParseException

getDocument

public <T extends Element> Document<T> getDocument(ParserOptions options)
                                        throws ParseException
Get the response payload as a parsed Abdera FOM Document using the specified parser options

Specified by:
getDocument in interface ClientResponse
Parameters:
options - The parser options
Throws:
ParseException

getDocument

public <T extends Element> Document<T> getDocument(Parser parser)
                                        throws ParseException
Get the response payload as a parsed Abdera FOM Document using the specified parser

Specified by:
getDocument in interface ClientResponse
Parameters:
parser - The parser
Throws:
ParseException

getDocument

public <T extends Element> Document<T> getDocument(Parser parser,
                                                   ParserOptions options)
                                        throws ParseException
Get the response payload as a parsed Abdera FOM Document using the specified parser and parser options

Specified by:
getDocument in interface ClientResponse
Parameters:
parser - The parser
options - The parser options
Throws:
ParseException

getInputStream

public InputStream getInputStream()
                           throws IOException
Get the response payload as an input stream

Specified by:
getInputStream in interface ClientResponse
Throws:
IOException

setInputStream

public void setInputStream(InputStream in)
Set the response input stream (used internally by Abdera)

Specified by:
setInputStream in interface ClientResponse

getReader

public Reader getReader()
                 throws IOException
Get the response payload as a reader (assumed UTF-8 charset)

Specified by:
getReader in interface ClientResponse
Throws:
IOException

getReader

public Reader getReader(String charset)
                 throws IOException
Get the response payload as a reader using the specified charset

Specified by:
getReader in interface ClientResponse
Parameters:
charset - The character set encoding
Throws:
IOException

getServerDate

public Date getServerDate()
Return the date returned by the server in the response

Specified by:
getServerDate in interface ClientResponse

parse_cc

protected void parse_cc()

getCharacterEncoding

public String getCharacterEncoding()
Get the character set encoding specified by the server in the Content-Type header

Specified by:
getCharacterEncoding in interface ClientResponse

getDateHeader

public Date getDateHeader(String header)
Return the named HTTP header as a java.util.Date

Specified by:
getDateHeader in interface Message


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