public class ResponseBuilderImpl extends Response.ResponseBuilder
| Modifier and Type | Field and Description |
|---|---|
protected Object |
entity |
protected Annotation[] |
entityAnnotations |
protected Headers<Object> |
metadata |
protected int |
status |
| Constructor and Description |
|---|
ResponseBuilderImpl() |
| Modifier and Type | Method and Description |
|---|---|
Response.ResponseBuilder |
allow(Set<String> methods)
Set the list of allowed methods for the resource.
|
Response.ResponseBuilder |
allow(String... methods)
Set the list of allowed methods for the resource.
|
Response |
build()
Create a Response instance from the current ResponseBuilder.
|
Response.ResponseBuilder |
cacheControl(CacheControl cacheControl)
Set the cache control data of the message.
|
Response.ResponseBuilder |
clone() |
Response.ResponseBuilder |
contentLocation(URI location)
Set the content location.
|
Response.ResponseBuilder |
cookie(NewCookie... cookies)
Add cookies to the response message.
|
static String |
createVaryHeader(List<Variant> variants) |
Response.ResponseBuilder |
encoding(String encoding)
Set the message entity content encoding.
|
Response.ResponseBuilder |
entity(Object entity)
Set the response entity in the builder.
|
Response.ResponseBuilder |
entity(Object entity,
Annotation[] annotations)
Set the response entity in the builder.
|
Response.ResponseBuilder |
expires(Date expires)
Set the response expiration date.
|
static SimpleDateFormat |
getDateFormatRFC822() |
Response.ResponseBuilder |
header(String name,
Object value)
Add an arbitrary header.
|
Response.ResponseBuilder |
language(Locale language)
Set the message entity language.
|
Response.ResponseBuilder |
language(String language)
Set the message entity language.
|
Response.ResponseBuilder |
lastModified(Date lastModified)
Set the response entity last modification date.
|
Response.ResponseBuilder |
link(String uri,
String rel)
Add a link header.
|
Response.ResponseBuilder |
link(URI uri,
String rel)
Add a link header.
|
Response.ResponseBuilder |
links(Link... links)
Add one or more link headers.
|
Response.ResponseBuilder |
location(URI location)
Set the location.
|
Response.ResponseBuilder |
replaceAll(MultivaluedMap<String,Object> headers)
Replaces all existing headers with the newly supplied headers.
|
Response.ResponseBuilder |
status(int status)
Set the status on the ResponseBuilder.
|
Response.ResponseBuilder |
tag(EntityTag tag)
Set a response entity tag.
|
Response.ResponseBuilder |
tag(String tag)
Set a strong response entity tag.
|
Response.ResponseBuilder |
type(MediaType type)
Set the message entity media type.
|
Response.ResponseBuilder |
type(String type)
Set the message entity media type.
|
Response.ResponseBuilder |
variant(Variant variant)
Set message entity representation metadata.
|
Response.ResponseBuilder |
variants(List<Variant> variants)
Add a Vary header that lists the available variants.
|
Response.ResponseBuilder |
variants(Variant... variants)
Add a Vary header that lists the available variants.
|
newInstance, status, statusprotected Object entity
protected Annotation[] entityAnnotations
protected int status
public Response build()
Response.ResponseBuilderbuild in class Response.ResponseBuilderpublic Response.ResponseBuilder clone()
Response.ResponseBuilderCreate a copy of the ResponseBuilder preserving its state.
clone in class Response.ResponseBuilderpublic Response.ResponseBuilder status(int status)
Response.ResponseBuilderstatus in class Response.ResponseBuilderstatus - the response status.public Response.ResponseBuilder entity(Object entity)
Response.ResponseBuilderGenericEntity if preservation of its generic
type is required. Note that the entity can be also set as an
input stream.
A specific entity media type can be set using one of the type(...)
methods.entity in class Response.ResponseBuilderentity - the request entity.Response.ResponseBuilder.entity(java.lang.Object, java.lang.annotation.Annotation[]),
Response.ResponseBuilder.type(javax.ws.rs.core.MediaType),
Response.ResponseBuilder.type(java.lang.String)public Response.ResponseBuilder entity(Object entity, Annotation[] annotations)
Response.ResponseBuilderGenericEntity if preservation of its generic
type is required. Note that the entity can be also set as an
input stream.
A specific entity media type can be set using one of the type(...)
methods.entity in class Response.ResponseBuilderentity - the request entity.annotations - annotations that will be passed to the MessageBodyWriter.Response.ResponseBuilder.entity(java.lang.Object),
Response.ResponseBuilder.type(javax.ws.rs.core.MediaType),
Response.ResponseBuilder.type(java.lang.String)public Response.ResponseBuilder type(MediaType type)
Response.ResponseBuildertype in class Response.ResponseBuildertype - the media type of the message entity. If null, any
existing value for type will be removed.public Response.ResponseBuilder type(String type)
Response.ResponseBuildertype in class Response.ResponseBuildertype - the media type of the message entity. If null, any
existing value for type will be removed.public Response.ResponseBuilder variant(Variant variant)
Response.ResponseBuildervariant in class Response.ResponseBuildervariant - metadata of the message entity, a null value is
equivalent to a variant with all null properties.Response.ResponseBuilder.encoding(java.lang.String),
Response.ResponseBuilder.language(java.util.Locale),
Response.ResponseBuilder.type(javax.ws.rs.core.MediaType)public Response.ResponseBuilder variants(List<Variant> variants)
Response.ResponseBuildervariants in class Response.ResponseBuildervariants - a list of available representation variants, a null
value will remove an existing value for Vary header.public Response.ResponseBuilder language(String language)
Response.ResponseBuilderlanguage in class Response.ResponseBuilderlanguage - the language of the message entity, if null any
existing value for language will be removed.public Response.ResponseBuilder location(URI location)
Response.ResponseBuilderlocation in class Response.ResponseBuilderlocation - the location. If a relative URI is supplied it will be
converted into an absolute URI by resolving it relative to the
base URI of the application (see UriInfo.getBaseUri()).
If null any existing value for location will be removed.public Response.ResponseBuilder contentLocation(URI location)
Response.ResponseBuildercontentLocation in class Response.ResponseBuilderlocation - the content location. Relative or absolute URIs
may be used for the value of content location. If null any
existing value for content location will be removed.public Response.ResponseBuilder tag(EntityTag tag)
Response.ResponseBuildertag in class Response.ResponseBuildertag - the entity tag, if null any existing entity tag
value will be removed.public Response.ResponseBuilder tag(String tag)
Response.ResponseBuildertag(new EntityTag(value)).tag in class Response.ResponseBuildertag - the string content of a strong entity tag. The JAX-RS
runtime will quote the supplied value when creating the header.
If null any existing entity tag value will be removed.public Response.ResponseBuilder lastModified(Date lastModified)
Response.ResponseBuilderlastModified in class Response.ResponseBuilderlastModified - the last modified date, if null any existing
last modified value will be removed.public Response.ResponseBuilder cacheControl(CacheControl cacheControl)
Response.ResponseBuildercacheControl in class Response.ResponseBuildercacheControl - the cache control directives, if null
any existing cache control directives will be removed.public Response.ResponseBuilder header(String name, Object value)
Response.ResponseBuilderheader in class Response.ResponseBuildername - the name of the headervalue - the value of the header, the header will be serialized
using a RuntimeDelegate.HeaderDelegate if
one is available via RuntimeDelegate.createHeaderDelegate(java.lang.Class)
for the class of value or using its toString method
if a header delegate is not available. If value is null
then all current headers of the same name will be removed.public Response.ResponseBuilder cookie(NewCookie... cookies)
Response.ResponseBuildercookie in class Response.ResponseBuildercookies - new cookies that will accompany the response. A null
value will remove all cookies, including those added via the
Response.ResponseBuilder.header(java.lang.String, java.lang.Object) method.public Response.ResponseBuilder language(Locale language)
Response.ResponseBuilderlanguage in class Response.ResponseBuilderlanguage - the language of the message entity, if null any
existing value for type will be removed.public static SimpleDateFormat getDateFormatRFC822()
public Response.ResponseBuilder expires(Date expires)
Response.ResponseBuilderexpires in class Response.ResponseBuilderexpires - the expiration date, if null removes any existing
expires value.public Response.ResponseBuilder allow(String... methods)
Response.ResponseBuilderallow in class Response.ResponseBuildermethods - the methods to be listed as allowed for the resource,
if null any existing allowed method list will be removed.public Response.ResponseBuilder allow(Set<String> methods)
Response.ResponseBuilderallow in class Response.ResponseBuildermethods - the methods to be listed as allowed for the resource,
if null any existing allowed method list will be removed.public Response.ResponseBuilder encoding(String encoding)
Response.ResponseBuilderencoding in class Response.ResponseBuilderencoding - the content encoding of the message entity,
if null any existing value for content encoding will be
removed.public Response.ResponseBuilder variants(Variant... variants)
Response.ResponseBuildervariants in class Response.ResponseBuildervariants - a list of available representation variants, a null
value will remove an existing value for Vary header.public Response.ResponseBuilder links(Link... links)
Response.ResponseBuilderlinks in class Response.ResponseBuilderlinks - links to be added to the message as headers, a null
value will remove any existing Link headers.public Response.ResponseBuilder link(URI uri, String rel)
Response.ResponseBuilderlink in class Response.ResponseBuilderuri - underlying URI for link header.rel - value of "rel" parameter.public Response.ResponseBuilder link(String uri, String rel)
Response.ResponseBuilderlink in class Response.ResponseBuilderuri - underlying URI for link header.rel - value of "rel" parameter.public Response.ResponseBuilder replaceAll(MultivaluedMap<String,Object> headers)
Response.ResponseBuilderreplaceAll in class Response.ResponseBuilderheaders - new headers to be set, if null all existing
headers will be removed.Copyright © 2017 JBoss by Red Hat. All rights reserved.