org.apache.abdera.protocol.client
Class RequestOptions

java.lang.Object
  extended by org.apache.abdera.protocol.util.AbstractMessage
      extended by org.apache.abdera.protocol.util.AbstractRequest
          extended by org.apache.abdera.protocol.client.RequestOptions
All Implemented Interfaces:
Message, Request, ProtocolConstants

public class RequestOptions
extends AbstractRequest
implements Request

The RequestOptions class allows a variety of options affecting the execution of the request to be modified.


Field Summary
 
Fields inherited from class org.apache.abdera.protocol.util.AbstractRequest
max_stale, min_fresh
 
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
RequestOptions()
           
RequestOptions(boolean no_cache)
          Create the RequestOptions object
RequestOptions(Date ifModifiedSince)
          Create the RequestOptions object with the specified If-Modified-Since header value
RequestOptions(Date ifModifiedSince, String... ifNoneMatch)
          Create the RequestOptions object with the specified If-Modified-Since and If-None-Match header values
RequestOptions(Date ifModifiedSince, String ifNoneMatch)
          Create the RequestOptions object with the specified If-Modified-Since and If-None-Match header values
RequestOptions(String... ifNoneMatch)
          Create the RequestOptions object with the specified If-None-Match header value
RequestOptions(String ifNoneMatch)
          Create the RequestOptions object with the specified If-None-Match header value
 
Method Summary
 RequestOptions addDateHeader(String header, Date value)
          Similar to setDateHeader but allows for multiple instances of the specified header
 RequestOptions addEncodedHeader(String header, String charset, String... values)
          Similar to setEncodedHeader, but allows for multiple instances of the specified header
 RequestOptions addEncodedHeader(String header, String charset, String value)
          Similar to setEncodedHeader, but allows for multiple instances of the specified header
 RequestOptions addHeader(String header, String... values)
          Similar to setHeader but allows for multiple instances of the specified header
 RequestOptions addHeader(String header, String value)
          Similar to setHeader but allows for multiple instances of the specified header
 String getCacheControl()
          Return the value of the Cache-Control header
 Date getDateHeader(String header)
          Returns the date value of the specified header
 String getHeader(String header)
          Returns the text value of the specified header
 String[] getHeaderNames()
          Returns a listing of header names
 String[] getHeaders(String header)
          Return a listing of text values for the specified header
 boolean getRevalidateWithAuth()
          Configure the AbderaClient Side cache to revalidate when using Authorization
 boolean getUseLocalCache()
          The difference between this and getNoCache is that this only disables the local cache without affecting the Cache-Control header.
 boolean is4xxRequestException()
          Return true if a RequestException should be thrown on 4xx responses
 boolean is5xxRequestException()
          Return true if a RequestException should be thrown on 5xx responses
 boolean isConditionalPut()
          True if HTTP Conditional Requests should be used automatically.
 boolean isFollowRedirects()
          True if the client should follow redirects automatically
 boolean isUseChunked()
          Should the request use chunked encoding?
 boolean isUseExpectContinue()
          Return true if Expect-Continue should be used
 boolean isUsePostOverride()
          Return whether the request should use the X-HTTP-Method-Override option
 RequestOptions removeHeaders(String name)
          Remove the specified HTTP header
 RequestOptions set4xxRequestException(boolean v)
          Set whether or not to throw a RequestExeption on 4xx responses
 RequestOptions set5xxRequestException(boolean v)
          Set whether or not to throw a RequestExeption on 5xx responses
 RequestOptions setAccept(String... accept)
          Sets the value of the HTTP Accept header
 RequestOptions setAccept(String accept)
          Sets the value of the HTTP Accept header
 RequestOptions setAcceptCharset(String... accept)
          Sets the value of the HTTP Accept-Charset header
 RequestOptions setAcceptCharset(String accept)
          Sets the value of the HTTP Accept-Charset header
 RequestOptions setAcceptEncoding(String... accept)
          Sets the value of the HTTP Accept-Encoding header
 RequestOptions setAcceptEncoding(String accept)
          Sets the value of the HTTP Accept-Encoding header
 RequestOptions setAcceptLanguage(Locale... locales)
           
 RequestOptions setAcceptLanguage(Locale locale)
           
 RequestOptions setAcceptLanguage(String... accept)
          Sets the value of the HTTP Accept-Language header
 RequestOptions setAcceptLanguage(String accept)
          Sets the value of the HTTP Accept-Language header
 RequestOptions setAuthorization(String auth)
          Set the value of the HTTP Authorization header
 RequestOptions setCacheControl(String cc)
          Sets the value of the HTTP Cache-Control header
 RequestOptions setConditionalPut(boolean conditional)
          True if HTTP Conditinal Request should be used automatically.
 RequestOptions setContentLocation(String iri)
           
 RequestOptions setContentType(javax.activation.MimeType value)
          Set the value of the HTTP Content-Type header
 RequestOptions setContentType(String value)
          Set the value of the HTTP Content-Type header
 RequestOptions setDateHeader(String header, Date value)
          Set the date value of the specified HTTP header
 RequestOptions setEncodedHeader(String header, String charset, String... values)
          Set the values of a header using proper encoding of non-ascii characters
 RequestOptions setEncodedHeader(String header, String charset, String value)
          Set the value of a header using proper encoding of non-ascii characters
 RequestOptions setFollowRedirects(boolean followredirects)
          True if the client should follow redirects automatically
 RequestOptions setHeader(String header, String... values)
          Set the value of the specified HTTP header
 RequestOptions setHeader(String header, String value)
          Set the value of the specified HTTP header
 RequestOptions setIfMatch(org.apache.abdera.util.EntityTag... entity_tags)
          Sets the value of the HTTP If-Match header
 RequestOptions setIfMatch(org.apache.abdera.util.EntityTag entity_tag)
          Sets the value of the HTTP If-Match header
 RequestOptions setIfMatch(String... entity_tags)
          Sets the value of the HTTP If-Match header
 RequestOptions setIfMatch(String entity_tag)
          Sets the value of the HTTP If-Match header
 RequestOptions setIfModifiedSince(Date date)
          Sets the value of the HTTP If-Modified-Since header
 RequestOptions setIfNoneMatch(org.apache.abdera.util.EntityTag... entity_tags)
          Sets the value of the HTTP If-None-Match header
 RequestOptions setIfNoneMatch(org.apache.abdera.util.EntityTag entity_tag)
          Sets the value of the HTTP If-None-Match header
 RequestOptions setIfNoneMatch(String... entity_tags)
          Sets the value of the HTTP If-None-Match header
 RequestOptions setIfNoneMatch(String entity_tag)
          Sets the value of the HTTP If-None-Match header
 RequestOptions setIfUnmodifiedSince(Date date)
          Sets the value of the HTTP If-Unmodified-Since header
 RequestOptions setRevalidateWithAuth(boolean revalidateAuth)
          Configure the AbderaClient Side cache to revalidate when using Authorization
 RequestOptions setSlug(String slug)
          Sets the value of the Atom Publishing Protocol Slug header
 RequestOptions setUseChunked(boolean useChunked)
          Set whether the request should use chunked encoding.
 RequestOptions setUseExpectContinue(boolean useExpect)
          Set whether or not to use the HTTP Expect-Continue mechanism (enabled by default)
 RequestOptions setUseLocalCache(boolean use_cache)
          True if the local client cache should be used
 RequestOptions setUsePostOverride(boolean useOverride)
          Set whether the request should use the X-HTTP-Method-Override option
 
Methods inherited from class org.apache.abdera.protocol.util.AbstractRequest
getAccept, getAcceptCharset, getAcceptEncoding, getAcceptLanguage, getAuthorization, getIfMatch, getIfModifiedSince, getIfNoneMatch, getIfUnmodifiedSince, getMaxStale, getMinFresh, isOnlyIfCached, setMaxAge, setMaxStale, setMinFresh, setNoCache, setNoStore, setNoTransform, setOnlyIfCached
 
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.Request
getAccept, getAcceptCharset, getAcceptEncoding, getAcceptLanguage, getAuthorization, getIfMatch, getIfModifiedSince, getIfNoneMatch, getIfUnmodifiedSince, getMaxStale, getMinFresh, isOnlyIfCached
 
Methods inherited from interface org.apache.abdera.protocol.Message
getContentLanguage, getContentLocation, getContentType, getDecodedHeader, getDecodedHeaders, getMaxAge, getSlug, isNoCache, isNoStore, isNoTransform
 

Constructor Detail

RequestOptions

public RequestOptions()

RequestOptions

public RequestOptions(Date ifModifiedSince)
Create the RequestOptions object with the specified If-Modified-Since header value

Parameters:
ifModifiedSince -

RequestOptions

public RequestOptions(String ifNoneMatch)
Create the RequestOptions object with the specified If-None-Match header value

Parameters:
IfNoneMatch -

RequestOptions

public RequestOptions(String... ifNoneMatch)
Create the RequestOptions object with the specified If-None-Match header value

Parameters:
IfNoneMatch -

RequestOptions

public RequestOptions(Date ifModifiedSince,
                      String ifNoneMatch)
Create the RequestOptions object with the specified If-Modified-Since and If-None-Match header values

Parameters:
ifModifiedSince -
IfNoneMatch -

RequestOptions

public RequestOptions(Date ifModifiedSince,
                      String... ifNoneMatch)
Create the RequestOptions object with the specified If-Modified-Since and If-None-Match header values

Parameters:
ifModifiedSince -
IfNoneMatch -

RequestOptions

public RequestOptions(boolean no_cache)
Create the RequestOptions object

Parameters:
no_cache - True if the request will indicate that cached responses should not be returned
Method Detail

getUseLocalCache

public boolean getUseLocalCache()
The difference between this and getNoCache is that this only disables the local cache without affecting the Cache-Control header.


setUseLocalCache

public RequestOptions setUseLocalCache(boolean use_cache)
True if the local client cache should be used


setContentType

public RequestOptions setContentType(String value)
Set the value of the HTTP Content-Type header


setContentLocation

public RequestOptions setContentLocation(String iri)

setContentType

public RequestOptions setContentType(javax.activation.MimeType value)
Set the value of the HTTP Content-Type header


setAuthorization

public RequestOptions setAuthorization(String auth)
Set the value of the HTTP Authorization header


setEncodedHeader

public RequestOptions setEncodedHeader(String header,
                                       String charset,
                                       String value)
Set the value of a header using proper encoding of non-ascii characters


setEncodedHeader

public RequestOptions setEncodedHeader(String header,
                                       String charset,
                                       String... values)
Set the values of a header using proper encoding of non-ascii characters


setHeader

public RequestOptions setHeader(String header,
                                String value)
Set the value of the specified HTTP header


setHeader

public RequestOptions setHeader(String header,
                                String... values)
Set the value of the specified HTTP header


setDateHeader

public RequestOptions setDateHeader(String header,
                                    Date value)
Set the date value of the specified HTTP header


addEncodedHeader

public RequestOptions addEncodedHeader(String header,
                                       String charset,
                                       String value)
Similar to setEncodedHeader, but allows for multiple instances of the specified header


addEncodedHeader

public RequestOptions addEncodedHeader(String header,
                                       String charset,
                                       String... values)
Similar to setEncodedHeader, but allows for multiple instances of the specified header


addHeader

public RequestOptions addHeader(String header,
                                String value)
Similar to setHeader but allows for multiple instances of the specified header


addHeader

public RequestOptions addHeader(String header,
                                String... values)
Similar to setHeader but allows for multiple instances of the specified header


addDateHeader

public RequestOptions addDateHeader(String header,
                                    Date value)
Similar to setDateHeader but allows for multiple instances of the specified header


getHeader

public String getHeader(String header)
Returns the text value of the specified header

Specified by:
getHeader in interface Message

getHeaders

public String[] getHeaders(String header)
Return a listing of text values for the specified header

Specified by:
getHeaders in interface Message

getDateHeader

public Date getDateHeader(String header)
Returns the date value of the specified header

Specified by:
getDateHeader in interface Message

getHeaderNames

public String[] getHeaderNames()
Returns a listing of header names

Specified by:
getHeaderNames in interface Message

setIfMatch

public RequestOptions setIfMatch(String entity_tag)
Sets the value of the HTTP If-Match header


setIfMatch

public RequestOptions setIfMatch(org.apache.abdera.util.EntityTag entity_tag)
Sets the value of the HTTP If-Match header


setIfMatch

public RequestOptions setIfMatch(org.apache.abdera.util.EntityTag... entity_tags)
Sets the value of the HTTP If-Match header


setIfMatch

public RequestOptions setIfMatch(String... entity_tags)
Sets the value of the HTTP If-Match header


setIfNoneMatch

public RequestOptions setIfNoneMatch(String entity_tag)
Sets the value of the HTTP If-None-Match header


setIfNoneMatch

public RequestOptions setIfNoneMatch(org.apache.abdera.util.EntityTag entity_tag)
Sets the value of the HTTP If-None-Match header


setIfNoneMatch

public RequestOptions setIfNoneMatch(org.apache.abdera.util.EntityTag... entity_tags)
Sets the value of the HTTP If-None-Match header


setIfNoneMatch

public RequestOptions setIfNoneMatch(String... entity_tags)
Sets the value of the HTTP If-None-Match header


setIfModifiedSince

public RequestOptions setIfModifiedSince(Date date)
Sets the value of the HTTP If-Modified-Since header


setIfUnmodifiedSince

public RequestOptions setIfUnmodifiedSince(Date date)
Sets the value of the HTTP If-Unmodified-Since header


setAccept

public RequestOptions setAccept(String accept)
Sets the value of the HTTP Accept header


setAccept

public RequestOptions setAccept(String... accept)
Sets the value of the HTTP Accept header


setAcceptLanguage

public RequestOptions setAcceptLanguage(Locale locale)

setAcceptLanguage

public RequestOptions setAcceptLanguage(Locale... locales)

setAcceptLanguage

public RequestOptions setAcceptLanguage(String accept)
Sets the value of the HTTP Accept-Language header


setAcceptLanguage

public RequestOptions setAcceptLanguage(String... accept)
Sets the value of the HTTP Accept-Language header


setAcceptCharset

public RequestOptions setAcceptCharset(String accept)
Sets the value of the HTTP Accept-Charset header


setAcceptCharset

public RequestOptions setAcceptCharset(String... accept)
Sets the value of the HTTP Accept-Charset header


setAcceptEncoding

public RequestOptions setAcceptEncoding(String accept)
Sets the value of the HTTP Accept-Encoding header


setAcceptEncoding

public RequestOptions setAcceptEncoding(String... accept)
Sets the value of the HTTP Accept-Encoding header


setSlug

public RequestOptions setSlug(String slug)
Sets the value of the Atom Publishing Protocol Slug header


setCacheControl

public RequestOptions setCacheControl(String cc)
Sets the value of the HTTP Cache-Control header


removeHeaders

public RequestOptions removeHeaders(String name)
Remove the specified HTTP header


getCacheControl

public String getCacheControl()
Return the value of the Cache-Control header

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

getRevalidateWithAuth

public boolean getRevalidateWithAuth()
Configure the AbderaClient Side cache to revalidate when using Authorization


setRevalidateWithAuth

public RequestOptions setRevalidateWithAuth(boolean revalidateAuth)
Configure the AbderaClient Side cache to revalidate when using Authorization


isUseChunked

public boolean isUseChunked()
Should the request use chunked encoding?


setUseChunked

public RequestOptions setUseChunked(boolean useChunked)
Set whether the request should use chunked encoding.


setUsePostOverride

public RequestOptions setUsePostOverride(boolean useOverride)
Set whether the request should use the X-HTTP-Method-Override option


isUsePostOverride

public boolean isUsePostOverride()
Return whether the request should use the X-HTTP-Method-Override option


set4xxRequestException

public RequestOptions set4xxRequestException(boolean v)
Set whether or not to throw a RequestExeption on 4xx responses


is4xxRequestException

public boolean is4xxRequestException()
Return true if a RequestException should be thrown on 4xx responses


set5xxRequestException

public RequestOptions set5xxRequestException(boolean v)
Set whether or not to throw a RequestExeption on 5xx responses


is5xxRequestException

public boolean is5xxRequestException()
Return true if a RequestException should be thrown on 5xx responses


setUseExpectContinue

public RequestOptions setUseExpectContinue(boolean useExpect)
Set whether or not to use the HTTP Expect-Continue mechanism (enabled by default)


isUseExpectContinue

public boolean isUseExpectContinue()
Return true if Expect-Continue should be used


isConditionalPut

public boolean isConditionalPut()
True if HTTP Conditional Requests should be used automatically. This only has an effect when putting a Document that has an ETag or Last-Modified date present


setConditionalPut

public RequestOptions setConditionalPut(boolean conditional)
True if HTTP Conditinal Request should be used automatically. This only has an effect when putting a Document that has an ETag or Last-Modified date present


isFollowRedirects

public boolean isFollowRedirects()
True if the client should follow redirects automatically


setFollowRedirects

public RequestOptions setFollowRedirects(boolean followredirects)
True if the client should follow redirects automatically



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