public class HttpResponseDecorator extends Object implements org.apache.http.HttpResponse
HttpResponse
, which allows for
simplified header access, as well as carrying the auto-parsed response data.
(see HTTPBuilder.parseResponse(HttpResponse, Object)
).HttpResponseDecorator.HeadersDecorator
Modifier and Type | Class and Description |
---|---|
class |
HttpResponseDecorator.HeadersDecorator
This class is returned by
getHeaders() . |
Constructor and Description |
---|
HttpResponseDecorator(org.apache.http.HttpResponse base,
HttpContextDecorator context,
Object parsedResponse) |
HttpResponseDecorator(org.apache.http.HttpResponse base,
Object parsedResponse) |
Modifier and Type | Method and Description |
---|---|
void |
addHeader(org.apache.http.Header arg0) |
void |
addHeader(String arg0,
String arg1) |
boolean |
containsHeader(String arg0) |
org.apache.http.Header[] |
getAllHeaders() |
String |
getContentType()
Get the content-type for this response.
|
HttpContextDecorator |
getContext()
Get the execution context used during this request
|
Object |
getData()
Return the parsed data from this response body.
|
org.apache.http.HttpEntity |
getEntity() |
org.apache.http.Header |
getFirstHeader(String arg0) |
HttpResponseDecorator.HeadersDecorator |
getHeaders()
Return a
HttpResponseDecorator.HeadersDecorator , which provides a more Groovy API for
accessing response headers. |
org.apache.http.Header[] |
getHeaders(String arg0) |
org.apache.http.Header |
getLastHeader(String arg0) |
Locale |
getLocale() |
org.apache.http.params.HttpParams |
getParams() |
org.apache.http.ProtocolVersion |
getProtocolVersion() |
int |
getStatus()
Get the response status code.
|
org.apache.http.StatusLine |
getStatusLine() |
org.apache.http.HeaderIterator |
headerIterator() |
org.apache.http.HeaderIterator |
headerIterator(String arg0) |
boolean |
isSuccess()
Quickly determine if the request resulted in an error code.
|
void |
removeHeader(org.apache.http.Header arg0) |
void |
removeHeaders(String arg0) |
void |
setEntity(org.apache.http.HttpEntity arg0) |
void |
setHeader(org.apache.http.Header arg0) |
void |
setHeader(String arg0,
String arg1) |
void |
setHeaders(org.apache.http.Header[] arg0) |
void |
setLocale(Locale arg0) |
void |
setParams(org.apache.http.params.HttpParams arg0) |
void |
setReasonPhrase(String arg0) |
void |
setStatusCode(int arg0) |
void |
setStatusLine(org.apache.http.ProtocolVersion arg0,
int arg1) |
void |
setStatusLine(org.apache.http.ProtocolVersion arg0,
int arg1,
String arg2) |
void |
setStatusLine(org.apache.http.StatusLine arg0) |
public HttpResponseDecorator(org.apache.http.HttpResponse base, Object parsedResponse)
public HttpResponseDecorator(org.apache.http.HttpResponse base, HttpContextDecorator context, Object parsedResponse)
public HttpResponseDecorator.HeadersDecorator getHeaders()
HttpResponseDecorator.HeadersDecorator
, which provides a more Groovy API for
accessing response headers.public boolean isSuccess()
Status.SUCCESS
public int getStatus()
StatusLine.getStatusCode()
public String getContentType()
HttpResponseContentTypeFinder.findContentType(HttpResponse)
public Object getData()
null
if the response
does not contain any data.public HttpContextDecorator getContext()
HttpContext
ExecutionContext
public org.apache.http.HttpEntity getEntity()
getEntity
in interface org.apache.http.HttpResponse
public Locale getLocale()
getLocale
in interface org.apache.http.HttpResponse
public org.apache.http.StatusLine getStatusLine()
getStatusLine
in interface org.apache.http.HttpResponse
public void setEntity(org.apache.http.HttpEntity arg0)
setEntity
in interface org.apache.http.HttpResponse
public void setLocale(Locale arg0)
setLocale
in interface org.apache.http.HttpResponse
public void setReasonPhrase(String arg0) throws IllegalStateException
setReasonPhrase
in interface org.apache.http.HttpResponse
IllegalStateException
public void setStatusCode(int arg0) throws IllegalStateException
setStatusCode
in interface org.apache.http.HttpResponse
IllegalStateException
public void setStatusLine(org.apache.http.StatusLine arg0)
setStatusLine
in interface org.apache.http.HttpResponse
public void setStatusLine(org.apache.http.ProtocolVersion arg0, int arg1)
setStatusLine
in interface org.apache.http.HttpResponse
public void setStatusLine(org.apache.http.ProtocolVersion arg0, int arg1, String arg2)
setStatusLine
in interface org.apache.http.HttpResponse
public void addHeader(org.apache.http.Header arg0)
addHeader
in interface org.apache.http.HttpMessage
public void addHeader(String arg0, String arg1)
addHeader
in interface org.apache.http.HttpMessage
public boolean containsHeader(String arg0)
containsHeader
in interface org.apache.http.HttpMessage
public org.apache.http.Header[] getAllHeaders()
getAllHeaders
in interface org.apache.http.HttpMessage
public org.apache.http.Header getFirstHeader(String arg0)
getFirstHeader
in interface org.apache.http.HttpMessage
public org.apache.http.Header[] getHeaders(String arg0)
getHeaders
in interface org.apache.http.HttpMessage
public org.apache.http.Header getLastHeader(String arg0)
getLastHeader
in interface org.apache.http.HttpMessage
public org.apache.http.params.HttpParams getParams()
getParams
in interface org.apache.http.HttpMessage
public org.apache.http.ProtocolVersion getProtocolVersion()
getProtocolVersion
in interface org.apache.http.HttpMessage
public org.apache.http.HeaderIterator headerIterator()
headerIterator
in interface org.apache.http.HttpMessage
public org.apache.http.HeaderIterator headerIterator(String arg0)
headerIterator
in interface org.apache.http.HttpMessage
public void removeHeader(org.apache.http.Header arg0)
removeHeader
in interface org.apache.http.HttpMessage
public void removeHeaders(String arg0)
removeHeaders
in interface org.apache.http.HttpMessage
public void setHeader(org.apache.http.Header arg0)
setHeader
in interface org.apache.http.HttpMessage
public void setHeader(String arg0, String arg1)
setHeader
in interface org.apache.http.HttpMessage
public void setHeaders(org.apache.http.Header[] arg0)
setHeaders
in interface org.apache.http.HttpMessage
public void setParams(org.apache.http.params.HttpParams arg0)
setParams
in interface org.apache.http.HttpMessage
Copyright © 2010–2019. All rights reserved.