Interface ODataResponse
- All Known Subinterfaces:
AsyncResponse
,ODataBatchResponse
,ODataDeleteResponse
,ODataEntityCreateResponse<E>
,ODataEntityUpdateResponse<E>
,ODataInvokeResponse<T>
,ODataMediaEntityCreateResponse<E>
,ODataMediaEntityUpdateResponse<E>
,ODataPropertyUpdateResponse
,ODataRawResponse
,ODataReferenceAddingResponse
,ODataRetrieveResponse<T>
,ODataStreamUpdateResponse
,ODataValueUpdateResponse
public interface ODataResponse
Abstract representation of an OData response.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Close the underlying message entity input stream (if available and open) as well as releases any other resources associated with the response.Gets the content type.getETag()
Gets 'ETag' header value.Gets header value of the given header.Gets header names.Gets response body as InputStream.int
Gets 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.initFromHttpResponse
(org.apache.http.HttpResponse res) Initializes OData response from HTTP response.
-
Method Details
-
getHeaderNames
Collection<String> getHeaderNames()Gets header names.- Returns:
- response header names.
-
getHeader
Gets header value of the given header.- Parameters:
name
- header to be retrieved.- Returns:
- response header value.
-
getETag
String getETag()Gets 'ETag' header value.- Returns:
- ETag header value, if provided
-
getContentType
String getContentType()Gets the content type.- Returns:
- content type
-
getStatusCode
int getStatusCode()Gets status code.- Returns:
- status code.
-
getStatusMessage
String getStatusMessage()Gets status message.- Returns:
- status message.
-
getRawResponse
InputStream getRawResponse()Gets response body as InputStream.- Returns:
- response body input stream.
-
initFromHttpResponse
Initializes OData response from HTTP response.- Parameters:
res
- HTTP response.- Returns:
- OData response;
-
initFromBatch
ODataResponse initFromBatch(Map.Entry<Integer, String> responseLine, Map<String, Collection<String>> headers, ODataBatchLineIterator batchLineIterator, String boundary) Initializes response from batch response item.- Parameters:
responseLine
- response line.headers
- response headers.batchLineIterator
- batch line iterator.boundary
- batch boundary.- Returns:
- OData response.
-
initFromEnclosedPart
Initializes response from an enclosed HTTP response.- Parameters:
part
- enclosed HTTP response.- Returns:
- OData response.
-
close
void close()Close 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.
-