Package org.apache.olingo.server.api
Class ODataRequest
java.lang.Object
org.apache.olingo.server.api.ODataRequest
Request object to carry HTTP information optimized for and required to handle OData requests only.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a header to the request.void
Adds a header to the request.Gets all headers.getBody()
Gets the body of the request.Gets first header value for a given name.getHeaders
(String name) Gets header values for a given name.Gets the HTTP method.Gets the base URI.Gets the path segments of the request URI that belong to OData.Gets the query part of the request URI.Gets the total request URI.Gets the URI part responsible for service resolution.void
setBody
(InputStream body) Sets the body of the request.void
Sets a header in the request.void
setMethod
(HttpMethod method) Sets the HTTP method.void
setProtocol
(String protocol) Sets the HTTP protocol usedvoid
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.
-
Constructor Details
-
ODataRequest
public ODataRequest()
-
-
Method Details
-
getMethod
Gets the HTTP method.- Returns:
- the HTTP method (GET, PUT, POST ...)
-
setMethod
Sets the HTTP method.- Parameters:
method
- the HTTP method (GET, PUT, POST ...)
-
setHeader
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 namevalue
- value for the given header name- See Also:
-
addHeader
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 namevalue
- value for the given header name- See Also:
-
addHeader
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 namevalues
- list of values for the given header name- See Also:
-
getHeaders
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
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
Gets all headers.- Returns:
- an unmodifiable Map of header names/values
-
getBody
Gets the body of the request.- Returns:
- the request payload as
InputStream
or null
-
setBody
Sets the body of the request.- Parameters:
body
- the request payload asInputStream
-
getRawQueryPath
Gets the query part of the request URI.- Returns:
- the undecoded query options, e.g., "
$format=json,$top=10
" - See Also:
-
setRawQueryPath
Sets the query part of the request URI.- See Also:
-
getRawBaseUri
Gets the base URI.- Returns:
- undecoded base URI, e.g., "
http://localhost/my%20service
"
-
setRawBaseUri
Sets the base URI.- See Also:
-
getRawRequestUri
Gets the total request URI.- Returns:
- undecoded request URI, e.g., "
http://localhost/my%20service/sys1/Employees?$format=json
"
-
setRawRequestUri
Sets the total request URI.- See Also:
-
getRawODataPath
Gets the path segments of the request URI that belong to OData.- Returns:
- undecoded OData path segments, e.g., "/Employees"
-
setRawODataPath
Sets the path segments of the request URI that belong to OData.- See Also:
-
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
Sets the URI part responsible for service resolution.- See Also:
-
getProtocol
- Returns:
- the protocol version used e.g. HTTP/1.1
-
setProtocol
Sets the HTTP protocol used- Parameters:
protocol
-- See Also:
-