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 Details

    • ODataResponse

      public ODataResponse()
  • Method Details

    • setStatusCode

      public void setStatusCode(int statusCode)
      Sets the status code.
      See Also:
    • getStatusCode

      public int getStatusCode()
      Gets the status code.
      See Also:
    • 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:
    • 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:
    • 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:
    • 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()