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

public abstract class AbstractODataResponse extends Object implements ODataResponse
Abstract representation of an OData response.
  • Field Details

    • LOG

      protected static final org.slf4j.Logger LOG
      Logger.
    • odataClient

      protected final ODataClient odataClient
    • httpClient

      protected final org.apache.http.client.HttpClient httpClient
      HTTP client.
    • res

      protected final org.apache.http.HttpResponse res
      HTTP response.
    • headers

      protected final Map<String,Collection<String>> headers
      Response headers.
    • statusCode

      protected int statusCode
      Response code.
    • statusMessage

      protected String statusMessage
      Response message.
    • payload

      protected InputStream payload
      Response body/payload.
    • hasBeenInitialized

      protected boolean hasBeenInitialized
      Initialization check.
    • batchInfo

      protected ODataBatchController 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

      public Collection<String> getHeaderNames()
      Description copied from interface: ODataResponse
      Gets header names.
      Specified by:
      getHeaderNames in interface ODataResponse
      Returns:
      response header names.
    • getHeader

      public Collection<String> getHeader(String name)
      Description copied from interface: ODataResponse
      Gets header value of the given header.
      Specified by:
      getHeader in interface ODataResponse
      Parameters:
      name - header to be retrieved.
      Returns:
      response header value.
    • getETag

      public String getETag()
      Description copied from interface: ODataResponse
      Gets 'ETag' header value.
      Specified by:
      getETag in interface ODataResponse
      Returns:
      ETag header value, if provided
    • getContentType

      public String getContentType()
      Description copied from interface: ODataResponse
      Gets the content type.
      Specified by:
      getContentType in interface ODataResponse
      Returns:
      content type
    • getStatusCode

      public int getStatusCode()
      Description copied from interface: ODataResponse
      Gets status code.
      Specified by:
      getStatusCode in interface ODataResponse
      Returns:
      status code.
    • getStatusMessage

      public String getStatusMessage()
      Description copied from interface: ODataResponse
      Gets status message.
      Specified by:
      getStatusMessage in interface ODataResponse
      Returns:
      status message.
    • initFromHttpResponse

      public final ODataResponse initFromHttpResponse(org.apache.http.HttpResponse res)
      Description copied from interface: ODataResponse
      Initializes OData response from HTTP response.
      Specified by:
      initFromHttpResponse in interface ODataResponse
      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: ODataResponse
      Initializes response from batch response item.
      Specified by:
      initFromBatch in interface ODataResponse
      Parameters:
      responseLine - response line.
      headers - response headers.
      batchLineIterator - batch line iterator.
      boundary - batch boundary.
      Returns:
      OData response.
    • initFromEnclosedPart

      public ODataResponse initFromEnclosedPart(InputStream part)
      Description copied from interface: ODataResponse
      Initializes response from an enclosed HTTP response.
      Specified by:
      initFromEnclosedPart in interface ODataResponse
      Parameters:
      part - enclosed HTTP response.
      Returns:
      OData response.
    • close

      public void close()
      Description copied from interface: ODataResponse
      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.

      Specified by:
      close in interface ODataResponse
    • closeHttpResponse

      protected void closeHttpResponse()
    • getRawResponse

      public InputStream getRawResponse()
      Description copied from interface: ODataResponse
      Gets response body as InputStream.
      Specified by:
      getRawResponse in interface ODataResponse
      Returns:
      response body input stream.