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 Details

    • ODataRequest

      public ODataRequest()
  • Method Details

    • 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:
    • 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:
    • 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:
    • 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:
    • setRawQueryPath

      public void setRawQueryPath(String rawQueryPath)
      Sets the query part of the request URI.
      See Also:
    • 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:
    • 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:
    • 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:
    • 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:
    • 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: