Class ODataResponse
java.lang.Object
org.apache.olingo.odata2.api.processor.ODataResponse
- Direct Known Subclasses:
ODataResponseImpl
An ODataResponse is usually created by an ODataProcessor during request handling.
The handler can use a serializer to create an OData body (== response entity) and can set various response headers. A response can be created using the builder pattern:
ODataResponse response = ODataResponse.entity("hello world").setStatus(HttpStatusCodes.OK).build();
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classImplementation of the builder pattern to create instances of this type of object. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voidclose()Close the underlying entity input stream (if such a stream is available) and release all with this repsonse associated resources.abstract booleancontainsHeader(String header) Case insensitive check if the header is available in this ODataResponsecontentHeader(String value) fromResponse(ODataResponse response) abstract Stringabstract Objectabstract StringgetETag()abstract Stringabstract Stringabstract HttpStatusCodesstatus(HttpStatusCodes status)
-
Field Details
-
CHARSET_MATCHER_PATTERN
-
-
Constructor Details
-
ODataResponse
protected ODataResponse()Do not subclass ODataResponse!
-
-
Method Details
-
getStatus
- Returns:
- HTTP status code of this response
-
getEntity
- Returns:
- a response entity which becomes the body part of a response message
-
getEntityAsStream
- Returns:
- a response entity as inputStream which becomes the body part of a response message
- Throws:
ODataException- throws ODataException in case of entity is not a stream (internal ClassCastException)
-
close
Close the underlying entity input stream (if such a stream is available) and release all with this repsonse associated resources.- Throws:
IOException- if something goes wrong during close ofODataResponse
-
getHeader
- Parameters:
name- HTTP response header name- Returns:
- a header value or null if not set
-
getContentHeader
- Returns:
- Content-Type header value or null if not set
-
getIdLiteral
- Returns:
- Location header value or null if not set
-
getETag
- Returns:
- ETag header value or null if not available
-
getHeaderNames
- Returns:
- a set of all available header names
-
containsHeader
Case insensitive check if the header is available in this ODataResponse- Parameters:
header- header name- Returns:
- true/false
-
status
- Parameters:
status- HTTP status code- Returns:
- a builder object
-
fromResponse
- Parameters:
response-- Returns:
- a new builder object
-
entity
- Parameters:
entity-- Returns:
- a builder object
-
header
- Parameters:
name- HTTP header namevalue- associated value- Returns:
- a builder object
-
contentHeader
- Parameters:
value- content header value- Returns:
- a builder object
-
newBuilder
- Returns:
- returns a new builder object
-