org.apache.olingo.server.api

## Class ODataRequest

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

-     public class ODataRequest
      extends Object

  Request object to carry HTTP information optimized for and required to handle OData requests only.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ODataRequest()`

  - ### 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 request.
    `void` | `addHeader(String name, String value)` Adds a header to the request.
    `Map<String,List<String>>` | `getAllHeaders()` Gets all headers.
    `InputStream` | `getBody()` Gets the body of the request.
    `String` | `getHeader(String name)` Gets first header value for a given name.
    `List<String>` | `getHeaders(String name)` Gets header values for a given name.
    `HttpMethod` | `getMethod()` Gets the HTTP method.
    `String` | `getProtocol()`
    `String` | `getRawBaseUri()` Gets the base URI.
    `String` | `getRawODataPath()` Gets the path segments of the request URI that belong to OData.
    `String` | `getRawQueryPath()` Gets the query part of the request URI.
    `String` | `getRawRequestUri()` Gets the total request URI.
    `String` | `getRawServiceResolutionUri()` Gets the URI part responsible for service resolution.
    `void` | `setBody(InputStream body)` Sets the body of the request.
    `void` | `setHeader(String name, String value)` Sets a header in the request.
    `void` | `setMethod(HttpMethod method)` Sets the HTTP method.
    `void` | `setProtocol(String protocol)` Sets the HTTP protocol used
    `void` | `setRawBaseUri(String rawBaseUri)` Sets the base URI.
    `void` | `setRawODataPath(String rawODataPath)` Sets the path segments of the request URI that belong to OData.
    `void` | `setRawQueryPath(String rawQueryPath)` Sets the query part of the request URI.
    `void` | `setRawRequestUri(String rawRequestUri)` Sets the total request URI.
    `void` | `setRawServiceResolutionUri(String rawServiceResolutionUri)` Sets the URI part responsible for service resolution.

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

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

- - ### Constructor Detail

    - #### ODataRequest

          public ODataRequest()

  - ### Method Detail

    - #### getMethod

          public HttpMethod getMethod()

      Gets the HTTP method.
      Returns:
        the HTTP method (GET, PUT, POST ...)

    - #### setMethod

          public void setMethod(HttpMethod method)

      Sets the HTTP method.
      Parameters:
        `method` - the HTTP method (GET, PUT, POST ...)

    - #### setHeader

          public void setHeader(String name,
                                String value)

      Sets a header in the request.

      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 request.

      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 request.

      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

    - #### getHeaders

          public List<String> getHeaders(String name)

      Gets header values 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.
      Parameters:
        `name` - the header name as a case-insensitive key
      Returns:
        the first header value or null if not found

    - #### getAllHeaders

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

      Gets all headers.
      Returns:
        an unmodifiable Map of header names/values

    - #### getBody

          public InputStream getBody()

      Gets the body of the request.
      Returns:
        the request payload as `InputStream` or null

    - #### setBody

          public void setBody(InputStream body)

      Sets the body of the request.
      Parameters:
        `body` - the request payload as `InputStream`

    - #### getRawQueryPath

          public String getRawQueryPath()

      Gets the query part of the request URI.
      Returns:
        the undecoded query options, e.g., "`$format=json,$top=10`"
      See Also:
        RFC 3986, section 3.4

    - #### setRawQueryPath

          public void setRawQueryPath(String rawQueryPath)

      Sets the query part of the request URI.
      See Also:
        `getRawQueryPath()`

    - #### getRawBaseUri

          public String getRawBaseUri()

      Gets the base URI.
      Returns:
        undecoded base URI, e.g., "`http://localhost/my%20service`"

    - #### setRawBaseUri

          public void setRawBaseUri(String rawBaseUri)

      Sets the base URI.
      See Also:
        `getRawBaseUri()`

    - #### getRawRequestUri

          public String getRawRequestUri()

      Gets the total request URI.
      Returns:
        undecoded request URI, e.g., "`http://localhost/my%20service/sys1/Employees?$format=json`"

    - #### setRawRequestUri

          public void setRawRequestUri(String rawRequestUri)

      Sets the total request URI.
      See Also:
        `getRawRequestUri()`

    - #### getRawODataPath

          public String getRawODataPath()

      Gets the path segments of the request URI that belong to OData.
      Returns:
        undecoded OData path segments, e.g., "/Employees"

    - #### setRawODataPath

          public void setRawODataPath(String rawODataPath)

      Sets the path segments of the request URI that belong to OData.
      See Also:
        `getRawODataPath()`

    - #### getRawServiceResolutionUri

          public String getRawServiceResolutionUri()

      Gets the URI part responsible for service resolution.
      Returns:
        undecoded path segments that do not belong to the OData URL schema or null, e.g., "`sys1`"

    - #### setRawServiceResolutionUri

          public void setRawServiceResolutionUri(String rawServiceResolutionUri)

      Sets the URI part responsible for service resolution.
      See Also:
        `getRawServiceResolutionUri()`

    - #### getProtocol

          public String getProtocol()

      Returns:
        the protocol version used e.g. HTTP/1.1

    - #### setProtocol

          public void setProtocol(String protocol)

      Sets the HTTP protocol used
      Parameters:
        `protocol` -
      See Also:
        `getProtocol()`

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