Class AbstractODataResponse
java.lang.Object
org.apache.olingo.client.core.communication.response.AbstractODataResponse
- All Implemented Interfaces:
ODataResponse
- Direct Known Subclasses:
AbstractODataInvokeRequest.ODataInvokeResponseImpl,AbstractODataRetrieveRequest.AbstractODataRetrieveResponse,AsyncResponseImpl,ODataBatchErrorResponse,ODataBatchRequestImpl.ODataBatchResponseImpl,ODataInvokeRequestImpl.ODataInvokeResponseImpl
Abstract representation of an OData response.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ODataBatchControllerBatch info (if to be batched).protected booleanInitialization check.protected final Map<String,Collection<String>> Response headers.protected final org.apache.http.client.HttpClientHTTP client.protected static final org.slf4j.LoggerLogger.protected final ODataClientprotected InputStreamResponse body/payload.protected final org.apache.http.HttpResponseHTTP response.protected intResponse code.protected StringResponse message. -
Constructor Summary
ConstructorsConstructorDescriptionAbstractODataResponse(ODataClient odataClient, org.apache.http.client.HttpClient httpclient, org.apache.http.HttpResponse res) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close the underlying message entity input stream (if available and open) as well as releases any other resources associated with the response.protected voidGets the content type.getETag()Gets 'ETag' header value.Gets header value of the given header.Gets header names.Gets response body as InputStream.intGets status code.Gets status message.initFromBatch(Map.Entry<Integer, String> responseLine, Map<String, Collection<String>> headers, ODataBatchLineIterator batchLineIterator, String boundary) Initializes response from batch response item.Initializes response from an enclosed HTTP response.final ODataResponseinitFromHttpResponse(org.apache.http.HttpResponse res) Initializes OData response from HTTP response.
-
Field Details
-
LOG
protected static final org.slf4j.Logger LOGLogger. -
odataClient
-
httpClient
protected final org.apache.http.client.HttpClient httpClientHTTP client. -
res
protected final org.apache.http.HttpResponse resHTTP response. -
headers
Response headers. -
statusCode
protected int statusCodeResponse code. -
statusMessage
Response message. -
payload
Response body/payload. -
hasBeenInitialized
protected boolean hasBeenInitializedInitialization check. -
batchInfo
Batch info (if to be batched).
-
-
Constructor Details
-
AbstractODataResponse
public AbstractODataResponse(ODataClient odataClient, org.apache.http.client.HttpClient httpclient, org.apache.http.HttpResponse res)
-
-
Method Details
-
getHeaderNames
Description copied from interface:ODataResponseGets header names.- Specified by:
getHeaderNamesin interfaceODataResponse- Returns:
- response header names.
-
getHeader
Description copied from interface:ODataResponseGets header value of the given header.- Specified by:
getHeaderin interfaceODataResponse- Parameters:
name- header to be retrieved.- Returns:
- response header value.
-
getETag
Description copied from interface:ODataResponseGets 'ETag' header value.- Specified by:
getETagin interfaceODataResponse- Returns:
- ETag header value, if provided
-
getContentType
Description copied from interface:ODataResponseGets the content type.- Specified by:
getContentTypein interfaceODataResponse- Returns:
- content type
-
getStatusCode
public int getStatusCode()Description copied from interface:ODataResponseGets status code.- Specified by:
getStatusCodein interfaceODataResponse- Returns:
- status code.
-
getStatusMessage
Description copied from interface:ODataResponseGets status message.- Specified by:
getStatusMessagein interfaceODataResponse- Returns:
- status message.
-
initFromHttpResponse
Description copied from interface:ODataResponseInitializes OData response from HTTP response.- Specified by:
initFromHttpResponsein interfaceODataResponse- Parameters:
res- HTTP response.- Returns:
- OData response;
-
initFromBatch
public ODataResponse initFromBatch(Map.Entry<Integer, String> responseLine, Map<String, Collection<String>> headers, ODataBatchLineIterator batchLineIterator, String boundary) Description copied from interface:ODataResponseInitializes response from batch response item.- Specified by:
initFromBatchin interfaceODataResponse- Parameters:
responseLine- response line.headers- response headers.batchLineIterator- batch line iterator.boundary- batch boundary.- Returns:
- OData response.
-
initFromEnclosedPart
Description copied from interface:ODataResponseInitializes response from an enclosed HTTP response.- Specified by:
initFromEnclosedPartin interfaceODataResponse- Parameters:
part- enclosed HTTP response.- Returns:
- OData response.
-
close
public void close()Description copied from interface:ODataResponseClose the underlying message entity input stream (if available and open) as well as releases any other resources associated with the response.This 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.
- Specified by:
closein interfaceODataResponse
-
closeHttpResponse
protected void closeHttpResponse() -
getRawResponse
Description copied from interface:ODataResponseGets response body as InputStream.- Specified by:
getRawResponsein interfaceODataResponse- Returns:
- response body input stream.
-