public abstract class ODataResponse extends Object
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();
Modifier and Type | Class and Description |
---|---|
static class |
ODataResponse.ODataResponseBuilder
Implementation of the builder pattern to create instances of this type of object.
|
Modifier and Type | Field and Description |
---|---|
static Pattern |
CHARSET_MATCHER_PATTERN |
Modifier | Constructor and Description |
---|---|
protected |
ODataResponse()
Do not subclass ODataResponse!
|
public static final Pattern CHARSET_MATCHER_PATTERN
public abstract HttpStatusCodes getStatus()
public abstract Object getEntity()
public InputStream getEntityAsStream() throws ODataException
ODataException
- throws ODataException in case of entity is not a stream (internal ClassCastException)public abstract void close() throws IOException
IOException
- if something goes wrong during close of ODataResponse
public abstract String getHeader(String name)
name
- HTTP response header namepublic abstract String getContentHeader()
public abstract String getIdLiteral()
public abstract String getETag()
public abstract Set<String> getHeaderNames()
public abstract boolean containsHeader(String header)
header
- header namepublic static ODataResponse.ODataResponseBuilder status(HttpStatusCodes status)
status
- HTTP status codepublic static ODataResponse.ODataResponseBuilder fromResponse(ODataResponse response)
response
- public static ODataResponse.ODataResponseBuilder entity(Object entity)
entity
- public static ODataResponse.ODataResponseBuilder header(String name, String value)
name
- HTTP header namevalue
- associated valuepublic static ODataResponse.ODataResponseBuilder contentHeader(String value)
value
- content header valuepublic static ODataResponse.ODataResponseBuilder newBuilder()
Copyright © 2013-2017 The Apache Software Foundation. All Rights Reserved.