public class GenericResponses extends Object
GenericResponse
corresponding to the utility methods from the Response
class.
This utility class is needed because Java 6 does not allow static methods on interfaces.
Modifier and Type | Method and Description |
---|---|
static <T> GenericResponseBuilder<T> |
accepted()
Create a new
GenericResponseBuilder with an ACCEPTED status. |
static <T> GenericResponseBuilder<T> |
accepted(T entity)
Create a new
GenericResponseBuilder with a ACCEPTED status and the given entity body. |
static <T> GenericResponseBuilder<T> |
created(T entity,
URI location)
Create a new
GenericResponseBuilder with a created status and the given entity body and
location. |
static <T> GenericResponseBuilder<T> |
fromResponse(GenericResponse<T> response)
Creates a new
GenericResponseBuilder by performing a shallow copy of the existing
response. |
static <T> GenericResponseBuilder<T> |
noContent()
Create a new
GenericResponseBuilder for an empty response. |
static <T> GenericResponseBuilder<T> |
notAcceptable(List<javax.ws.rs.core.Variant> variants)
Create a new
GenericResponseBuilder for a not acceptable response. |
static <T> GenericResponseBuilder<T> |
notModified()
Create a new
GenericResponseBuilder with a not-modified status. |
static <T> GenericResponseBuilder<T> |
notModified(javax.ws.rs.core.EntityTag tag)
Create a new
GenericResponseBuilder with a not-modified status. |
static <T> GenericResponseBuilder<T> |
notModified(String tag)
Create a new
GenericResponseBuilder with a not-modified status. |
static <T> GenericResponseBuilder<T> |
ok()
Create a new
GenericResponseBuilder with an OK status. |
static <T> GenericResponseBuilder<T> |
ok(T entity)
Create a new
GenericResponseBuilder with an OK status and the given entity body. |
static <T> GenericResponseBuilder<T> |
ok(T entity,
javax.ws.rs.core.MediaType type)
Create a new
GenericResponseBuilder with an OK status and the given entity body and
media type. |
static <T> GenericResponseBuilder<T> |
ok(T entity,
String type)
Create a new
GenericResponseBuilder with an OK status and the given entity body and
media type. |
static <T> GenericResponseBuilder<T> |
ok(T entity,
javax.ws.rs.core.Variant variant)
/**
Create a new
GenericResponseBuilder with an OK status and the given entity body and
variant data. |
static <T> GenericResponseBuilder<T> |
seeOther(URI location)
Create a new
GenericResponseBuilder for a redirection. |
static <T> GenericResponseBuilder<T> |
serverError()
Create a new
GenericResponseBuilder with a server error status. |
static <T> GenericResponseBuilder<T> |
status(int status)
Creates a new
GenericResponseBuilder with the given HTTP status. |
static <T> GenericResponseBuilder<T> |
status(int status,
T entity)
Creates a new
GenericResponseBuilder with the given HTTP status and entity body. |
static <T> GenericResponseBuilder<T> |
status(javax.ws.rs.core.Response.Status status)
Creates a new
GenericResponseBuilder with the given HTTP status. |
static <T> GenericResponseBuilder<T> |
status(javax.ws.rs.core.Response.StatusType status)
Creates a new
GenericResponseBuilder with the given HTTP status. |
static <T> GenericResponseBuilder<T> |
temporaryRedirect(URI location)
Create a new
GenericResponseBuilder for a temporary redirection. |
public static <T> GenericResponseBuilder<T> fromResponse(GenericResponse<T> response)
GenericResponseBuilder
by performing a shallow copy of the existing
response.response
- the GenericResponse
to create a new builder from.Response.ResponseBuilder#fromResponse(Response)
public static <T> GenericResponseBuilder<T> status(javax.ws.rs.core.Response.StatusType status)
GenericResponseBuilder
with the given HTTP status.status
- the response status.public static <T> GenericResponseBuilder<T> status(javax.ws.rs.core.Response.Status status)
GenericResponseBuilder
with the given HTTP status.status
- the response status.public static <T> GenericResponseBuilder<T> status(int status)
GenericResponseBuilder
with the given HTTP status.status
- the response status.public static <T> GenericResponseBuilder<T> status(int status, T entity)
GenericResponseBuilder
with the given HTTP status and entity body.status
- the response statusentity
- the response entitypublic static <T> GenericResponseBuilder<T> ok()
GenericResponseBuilder
with an OK status.public static <T> GenericResponseBuilder<T> ok(T entity)
GenericResponseBuilder
with an OK status and the given entity body.entity
- the response entitypublic static <T> GenericResponseBuilder<T> ok(T entity, javax.ws.rs.core.MediaType type)
GenericResponseBuilder
with an OK status and the given entity body and
media type.entity
- the response entitytype
- the response entity media typepublic static <T> GenericResponseBuilder<T> ok(T entity, String type)
GenericResponseBuilder
with an OK status and the given entity body and
media type.entity
- the response entitytype
- the response entity media typepublic static <T> GenericResponseBuilder<T> ok(T entity, javax.ws.rs.core.Variant variant)
GenericResponseBuilder
with an OK status and the given entity body and
variant data.
The variant data includes the content type, language, and encoding.
entity
- the response entityvariant
- the variant dataVariant
public static <T> GenericResponseBuilder<T> serverError()
GenericResponseBuilder
with a server error status.public static <T> GenericResponseBuilder<T> created(T entity, URI location)
GenericResponseBuilder
with a created status and the given entity body and
location.entity
- the response entitylocation
- the URI of the newly created resourcepublic static <T> GenericResponseBuilder<T> accepted()
GenericResponseBuilder
with an ACCEPTED status.public static <T> GenericResponseBuilder<T> accepted(T entity)
GenericResponseBuilder
with a ACCEPTED status and the given entity body.entity
- the response entitypublic static <T> GenericResponseBuilder<T> noContent()
GenericResponseBuilder
for an empty response.public static <T> GenericResponseBuilder<T> notModified()
GenericResponseBuilder
with a not-modified status.public static <T> GenericResponseBuilder<T> notModified(javax.ws.rs.core.EntityTag tag)
GenericResponseBuilder
with a not-modified status.tag
- the entity tag of the unmodified entitypublic static <T> GenericResponseBuilder<T> notModified(String tag)
GenericResponseBuilder
with a not-modified status.tag
- the entity tag of the unmodified entitypublic static <T> GenericResponseBuilder<T> seeOther(URI location)
GenericResponseBuilder
for a redirection.location
- the redirection URIResponse.ResponseBuilder#seeOther(URI)
public static <T> GenericResponseBuilder<T> temporaryRedirect(URI location)
GenericResponseBuilder
for a temporary redirection.location
- the redirection URIResponse.ResponseBuilder#temporaryRedirect(URI)
public static <T> GenericResponseBuilder<T> notAcceptable(List<javax.ws.rs.core.Variant> variants)
GenericResponseBuilder
for a not acceptable response.variants
- list of variants that were availableCopyright © 2017 Cerner Innovation, Inc.. All rights reserved.