groovyx.net.http
Class HttpResponseDecorator

java.lang.Object  extended by groovyx.net.http.HttpResponseDecorator
All Implemented Interfaces:
org.apache.http.HttpMessage, org.apache.http.HttpResponse

public class HttpResponseDecorator
extends Object
implements org.apache.http.HttpResponse

This class is a wrapper for HttpResponse, which allows for simplified header access, as well as carrying the auto-parsed response data. (see HTTPBuilder.parseResponse(HttpResponse, Object)).

Since:
0.5.0
Author:
Tom Nichols
See Also:
HttpResponseDecorator.HeadersDecorator


Nested Class Summary
 classHttpResponseDecorator.HeadersDecorator
          This class is returned by getHeaders().
 
Constructor Summary
HttpResponseDecorator(org.apache.http.HttpResponse base, HttpContextDecorator context, Object parsedResponse)
           
HttpResponseDecorator(org.apache.http.HttpResponse base, Object parsedResponse)
           
 
Method Summary
 voidaddHeader(org.apache.http.Header arg0)
           
 voidaddHeader(String arg0, String arg1)
           
 booleancontainsHeader(String arg0)
           
 org.apache.http.Header[]getAllHeaders()
           
 StringgetContentType()
          Get the content-type for this response.
 HttpContextDecoratorgetContext()
          Get the execution context used during this request
 ObjectgetData()
          Return the parsed data from this response body.
 org.apache.http.HttpEntitygetEntity()
           
 org.apache.http.HeadergetFirstHeader(String arg0)
           
 HttpResponseDecorator.HeadersDecoratorgetHeaders()
          Return a HttpResponseDecorator.HeadersDecorator, which provides a more Groovy API for accessing response headers.
 org.apache.http.Header[]getHeaders(String arg0)
           
 org.apache.http.HeadergetLastHeader(String arg0)
           
 LocalegetLocale()
           
 org.apache.http.params.HttpParamsgetParams()
           
 org.apache.http.ProtocolVersiongetProtocolVersion()
           
 intgetStatus()
          Get the response status code.
 org.apache.http.StatusLinegetStatusLine()
           
 org.apache.http.HeaderIteratorheaderIterator()
           
 org.apache.http.HeaderIteratorheaderIterator(String arg0)
           
 booleanisSuccess()
          Quickly determine if the request resulted in an error code.
 voidremoveHeader(org.apache.http.Header arg0)
           
 voidremoveHeaders(String arg0)
           
 voidsetEntity(org.apache.http.HttpEntity arg0)
           
 voidsetHeader(org.apache.http.Header arg0)
           
 voidsetHeader(String arg0, String arg1)
           
 voidsetHeaders(org.apache.http.Header[] arg0)
           
 voidsetLocale(Locale arg0)
           
 voidsetParams(org.apache.http.params.HttpParams arg0)
           
 voidsetReasonPhrase(String arg0)
           
 voidsetStatusCode(int arg0)
           
 voidsetStatusLine(org.apache.http.ProtocolVersion arg0, int arg1)
           
 voidsetStatusLine(org.apache.http.ProtocolVersion arg0, int arg1, String arg2)
           
 voidsetStatusLine(org.apache.http.StatusLine arg0)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpResponseDecorator

public HttpResponseDecorator(org.apache.http.HttpResponse base,                             Object parsedResponse)

HttpResponseDecorator

public HttpResponseDecorator(org.apache.http.HttpResponse base,                             HttpContextDecorator context,                             Object parsedResponse)
Method Detail

getHeaders

public HttpResponseDecorator.HeadersDecorator getHeaders()
Return a HttpResponseDecorator.HeadersDecorator, which provides a more Groovy API for accessing response headers.

Returns:
the headers for this response

isSuccess

public boolean isSuccess()
Quickly determine if the request resulted in an error code.

Returns:
true if the response code is within the range of Status.SUCCESS

getStatus

public int getStatus()
Get the response status code.

Returns:
the HTTP response code.
See Also:
StatusLine.getStatusCode()

getContentType

public String getContentType()
Get the content-type for this response.

Returns:
the content-type string, without any charset information.
See Also:
ParserRegistry.getContentType(HttpResponse)

getData

public Object getData()
Return the parsed data from this response body.

Returns:
the parsed response object, or null if the response does not contain any data.

getContext

public HttpContextDecorator getContext()
Get the execution context used during this request

Returns:
the HttpContext
See Also:
ExecutionContext

getEntity

public org.apache.http.HttpEntity getEntity()
Specified by:
getEntity in interface org.apache.http.HttpResponse

getLocale

public Locale getLocale()
Specified by:
getLocale in interface org.apache.http.HttpResponse

getStatusLine

public org.apache.http.StatusLine getStatusLine()
Specified by:
getStatusLine in interface org.apache.http.HttpResponse

setEntity

public void setEntity(org.apache.http.HttpEntity arg0)
Specified by:
setEntity in interface org.apache.http.HttpResponse

setLocale

public void setLocale(Locale arg0)
Specified by:
setLocale in interface org.apache.http.HttpResponse

setReasonPhrase

public void setReasonPhrase(String arg0)                     throws IllegalStateException
Specified by:
setReasonPhrase in interface org.apache.http.HttpResponse
Throws:
IllegalStateException

setStatusCode

public void setStatusCode(int arg0)                   throws IllegalStateException
Specified by:
setStatusCode in interface org.apache.http.HttpResponse
Throws:
IllegalStateException

setStatusLine

public void setStatusLine(org.apache.http.StatusLine arg0)
Specified by:
setStatusLine in interface org.apache.http.HttpResponse

setStatusLine

public void setStatusLine(org.apache.http.ProtocolVersion arg0,                          int arg1)
Specified by:
setStatusLine in interface org.apache.http.HttpResponse

setStatusLine

public void setStatusLine(org.apache.http.ProtocolVersion arg0,                          int arg1,                          String arg2)
Specified by:
setStatusLine in interface org.apache.http.HttpResponse

addHeader

public void addHeader(org.apache.http.Header arg0)
Specified by:
addHeader in interface org.apache.http.HttpMessage

addHeader

public void addHeader(String arg0,                      String arg1)
Specified by:
addHeader in interface org.apache.http.HttpMessage

containsHeader

public boolean containsHeader(String arg0)
Specified by:
containsHeader in interface org.apache.http.HttpMessage

getAllHeaders

public org.apache.http.Header[] getAllHeaders()
Specified by:
getAllHeaders in interface org.apache.http.HttpMessage

getFirstHeader

public org.apache.http.Header getFirstHeader(String arg0)
Specified by:
getFirstHeader in interface org.apache.http.HttpMessage

getHeaders

public org.apache.http.Header[] getHeaders(String arg0)
Specified by:
getHeaders in interface org.apache.http.HttpMessage

getLastHeader

public org.apache.http.Header getLastHeader(String arg0)
Specified by:
getLastHeader in interface org.apache.http.HttpMessage

getParams

public org.apache.http.params.HttpParams getParams()
Specified by:
getParams in interface org.apache.http.HttpMessage

getProtocolVersion

public org.apache.http.ProtocolVersion getProtocolVersion()
Specified by:
getProtocolVersion in interface org.apache.http.HttpMessage

headerIterator

public org.apache.http.HeaderIterator headerIterator()
Specified by:
headerIterator in interface org.apache.http.HttpMessage

headerIterator

public org.apache.http.HeaderIterator headerIterator(String arg0)
Specified by:
headerIterator in interface org.apache.http.HttpMessage

removeHeader

public void removeHeader(org.apache.http.Header arg0)
Specified by:
removeHeader in interface org.apache.http.HttpMessage

removeHeaders

public void removeHeaders(String arg0)
Specified by:
removeHeaders in interface org.apache.http.HttpMessage

setHeader

public void setHeader(org.apache.http.Header arg0)
Specified by:
setHeader in interface org.apache.http.HttpMessage

setHeader

public void setHeader(String arg0,                      String arg1)
Specified by:
setHeader in interface org.apache.http.HttpMessage

setHeaders

public void setHeaders(org.apache.http.Header[] arg0)
Specified by:
setHeaders in interface org.apache.http.HttpMessage

setParams

public void setParams(org.apache.http.params.HttpParams arg0)
Specified by:
setParams in interface org.apache.http.HttpMessage


Copyright © 2008-2012. All Rights Reserved.


NOTHING
NOTHING
Add the Maven Dependecy to your project: maven dependecy for com.amazonaws : aws-java-sdk : 1.3.14