public abstract class AbstractODataResponse extends Object implements ODataResponse
| Modifier and Type | Field and Description |
|---|---|
protected ODataBatchController |
batchInfo
Batch info (if to be batched).
|
protected boolean |
hasBeenInitialized
Initialization check.
|
protected Map<String,Collection<String>> |
headers
Response headers.
|
protected org.apache.http.client.HttpClient |
httpClient
HTTP client.
|
protected static org.slf4j.Logger |
LOG
Logger.
|
protected ODataClient |
odataClient |
protected InputStream |
payload
Response body/payload.
|
protected org.apache.http.HttpResponse |
res
HTTP response.
|
protected int |
statusCode
Response code.
|
protected String |
statusMessage
Response message.
|
| Constructor and Description |
|---|
AbstractODataResponse(ODataClient odataClient,
org.apache.http.client.HttpClient httpclient,
org.apache.http.HttpResponse res) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the underlying message entity input stream (if available and open) as well as releases any other resources
associated with the response.
|
protected void |
closeHttpResponse() |
String |
getContentType()
Gets the content type.
|
String |
getETag()
Gets 'ETag' header value.
|
Collection<String> |
getHeader(String name)
Gets header value of the given header.
|
Collection<String> |
getHeaderNames()
Gets header names.
|
InputStream |
getRawResponse()
Gets response body as InputStream.
|
int |
getStatusCode()
Gets status code.
|
String |
getStatusMessage()
Gets status message.
|
ODataResponse |
initFromBatch(Map.Entry<Integer,String> responseLine,
Map<String,Collection<String>> headers,
ODataBatchLineIterator batchLineIterator,
String boundary)
Initializes response from batch response item.
|
ODataResponse |
initFromEnclosedPart(InputStream part)
Initializes response from an enclosed HTTP response.
|
ODataResponse |
initFromHttpResponse(org.apache.http.HttpResponse res)
Initializes OData response from HTTP response.
|
protected static final org.slf4j.Logger LOG
protected final ODataClient odataClient
protected final org.apache.http.client.HttpClient httpClient
protected final org.apache.http.HttpResponse res
protected final Map<String,Collection<String>> headers
protected int statusCode
protected String statusMessage
protected InputStream payload
protected boolean hasBeenInitialized
protected ODataBatchController batchInfo
public AbstractODataResponse(ODataClient odataClient, org.apache.http.client.HttpClient httpclient, org.apache.http.HttpResponse res)
public Collection<String> getHeaderNames()
ODataResponsegetHeaderNames in interface ODataResponsepublic Collection<String> getHeader(String name)
ODataResponsegetHeader in interface ODataResponsename - header to be retrieved.public String getETag()
ODataResponsegetETag in interface ODataResponsepublic String getContentType()
ODataResponsegetContentType in interface ODataResponsepublic int getStatusCode()
ODataResponsegetStatusCode in interface ODataResponsepublic String getStatusMessage()
ODataResponsegetStatusMessage in interface ODataResponsepublic final ODataResponse initFromHttpResponse(org.apache.http.HttpResponse res)
ODataResponseinitFromHttpResponse in interface ODataResponseres - HTTP response.public ODataResponse initFromBatch(Map.Entry<Integer,String> responseLine, Map<String,Collection<String>> headers, ODataBatchLineIterator batchLineIterator, String boundary)
ODataResponseinitFromBatch in interface ODataResponseresponseLine - response line.headers - response headers.batchLineIterator - batch line iterator.boundary - batch boundary.public ODataResponse initFromEnclosedPart(InputStream part)
ODataResponseinitFromEnclosedPart in interface ODataResponsepart - enclosed HTTP response.public void close()
ODataResponseThis operation is idempotent, i.e. it can be invoked multiple times with the same effect which also means that calling the close() method on an already closed message instance is legal and has no further effect.
The close() method should be invoked on all instances that contain an un-consumed entity input stream to ensure the resources associated with the instance are properly cleaned-up and prevent potential memory leaks. This is typical for client-side scenarios where application layer code processes only the response headers and ignores the response entity.
close in interface ODataResponseprotected void closeHttpResponse()
public InputStream getRawResponse()
ODataResponsegetRawResponse in interface ODataResponseCopyright © 2023. All rights reserved.