org.apache.olingo.client.api.communication.response

## 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

    All Methods Instance Methods Abstract Methods
    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.
    `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.

- - ### Method Detail

    - #### getHeaderNames

          Collection<String> getHeaderNames()

      Gets header names.
      Returns:
        response header names.

    - #### getHeader

          Collection<String> getHeader(String name)

      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

          ODataResponse initFromHttpResponse(org.apache.http.HttpResponse res)

      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

          ODataResponse initFromEnclosedPart(InputStream part)

      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.

Copyright © 2013–2022 The Apache Software Foundation. All rights reserved.