org.apache.olingo.server.api

## Class ODataResponse

- java.lang.Object
- - org.apache.olingo.server.api.ODataResponse

-     public class ODataResponse
      extends Object

  Response object to carry OData-relevant HTTP information (status code, response headers, and content).

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ODataResponse()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addHeader(String name, List<String> values)` Adds a header to the response.
    `void` | `addHeader(String name, String value)` Adds a header to the response.
    `Map<String,List<String>>` | `getAllHeaders()` Get all headers with the according values.
    `InputStream` | `getContent()` Gets the content (body).
    `String` | `getHeader(String name)` Gets first header value for a given name.
    `List<String>` | `getHeaders(String name)` Gets header value for a given name.
    `ODataContent` | `getODataContent()`
    `int` | `getStatusCode()` Gets the status code.
    `void` | `setContent(InputStream content)` Sets the content (body).
    `void` | `setHeader(String name, String value)` Set a header to the response.
    `void` | `setODataContent(ODataContent result)`
    `void` | `setStatusCode(int statusCode)` Sets the status code.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ODataResponse

          public ODataResponse()

  - ### Method Detail

    - #### setStatusCode

          public void setStatusCode(int statusCode)

      Sets the status code.
      See Also:
        `HttpStatusCode`

    - #### getStatusCode

          public int getStatusCode()

      Gets the status code.
      See Also:
        `HttpStatusCode`

    - #### setHeader

          public void setHeader(String name,
                                String value)

      Set a header to the response.

      The header name will be handled as case-insensitive key.

      If a header already exists then the header will be replaced by this new value.

      Parameters:
        `name` - case-insensitive header name
        `value` - value for the given header name
      See Also:
        RFC 7230, section 3.2.2

    - #### addHeader

          public void addHeader(String name,
                                String value)

      Adds a header to the response.

      The header name will be handled as case-insensitive key.

      If a header already exists then the list of values will just be extended.

      Parameters:
        `name` - case-insensitive header name
        `value` - value for the given header name
      See Also:
        RFC 7230, section 3.2.2

    - #### addHeader

          public void addHeader(String name,
                                List<String> values)

      Adds a header to the response.

      The header name will be handled as case-insensitive key.

      If a header already exists then the list of values will just be extended.

      Parameters:
        `name` - case-insensitive header name
        `values` - list of values for the given header name
      See Also:
        RFC 7230, section 3.2.2

    - #### getAllHeaders

          public Map<String,List<String>> getAllHeaders()

      Get all headers with the according values.
      Returns:
        an unmodifiable Map of header names/values

    - #### getHeaders

          public List<String> getHeaders(String name)

      Gets header value for a given name.
      Parameters:
        `name` - the header name as a case-insensitive key
      Returns:
        the header value(s) or null if not found

    - #### getHeader

          public String getHeader(String name)

      Gets first header value for a given name. If header name is not known `null` is returned.
      Parameters:
        `name` - the header name as a case-insensitive key
      Returns:
        the first header value or null if not found

    - #### setContent

          public void setContent(InputStream content)

      Sets the content (body).
      Parameters:
        `content` - the content as `InputStream`

    - #### getContent

          public InputStream getContent()

      Gets the content (body).
      Returns:
        the content as `InputStream`

    - #### setODataContent

          public void setODataContent(ODataContent result)

    - #### getODataContent

          public ODataContent getODataContent()

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