Class AbstractRestResponseBuilder<T>
- java.lang.Object
-
- org.jboss.resteasy.reactive.RestResponse.ResponseBuilder<T>
-
- org.jboss.resteasy.reactive.common.jaxrs.AbstractRestResponseBuilder<T>
-
public abstract class AbstractRestResponseBuilder<T> extends RestResponse.ResponseBuilder<T>
-
-
Field Summary
Fields Modifier and Type Field Description protected Objectentityprotected Annotation[]entityAnnotationsprotected MultivaluedTreeMap<String,Object>metadataprotected StringreasonPhraseprotected intstatus
-
Constructor Summary
Constructors Constructor Description AbstractRestResponseBuilder()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description RestResponse.ResponseBuilder<T>allow(String... methods)Set the list of allowed methods for the resource.RestResponse.ResponseBuilder<T>allow(Set<String> methods)Set the list of allowed methods for the resource.RestResponseImpl<T>build()Create a RestResponse instance from the current ResponseBuilder.RestResponseImpl<T>build(boolean copyHeaders)RestResponse.ResponseBuilder<T>cacheControl(jakarta.ws.rs.core.CacheControl cacheControl)Set the cache control data of the message.AbstractRestResponseBuilder<T>clone()RestResponse.ResponseBuilder<T>cookie(jakarta.ws.rs.core.NewCookie... cookies)Add cookies to the response message.static StringcreateVaryHeader(List<jakarta.ws.rs.core.Variant> variants)protected abstract AbstractRestResponseBuilder<T>doClone()RestResponse.ResponseBuilder<T>encoding(String encoding)Set the message entity content encoding.RestResponse.ResponseBuilder<T>entity(T entity)Set the response entity in the builder.RestResponse.ResponseBuilder<T>entity(T entity, Annotation[] annotations)Set the response entity in the builder.RestResponse.ResponseBuilder<T>expires(Date expires)Set the response expiration date.static SimpleDateFormatgetDateFormatRFC822()ObjectgetEntity()Annotation[]getEntityAnnotations()jakarta.ws.rs.core.MultivaluedMap<String,Object>getMetadata()StringgetReasonPhrase()intgetStatus()RestResponse.ResponseBuilder<T>header(String name, Object value)Add an arbitrary header.RestResponse.ResponseBuilder<T>language(String language)Set the message entity language.RestResponse.ResponseBuilder<T>language(Locale language)Set the message entity language.RestResponse.ResponseBuilder<T>lastModified(Date lastModified)Set the response entity last modification date.RestResponse.ResponseBuilder<T>link(String uri, String rel)Add a link header.RestResponse.ResponseBuilder<T>link(URI uri, String rel)Add a link header.RestResponse.ResponseBuilder<T>links(jakarta.ws.rs.core.Link... links)Add one or more link headers.<OtherT extends RestResponseImpl<T>>
OtherTpopulateResponse(OtherT response)Populates a response with the standard data<OtherT extends RestResponseImpl<T>>
OtherTpopulateResponse(OtherT response, boolean copyHeaders)RestResponse.ResponseBuilder<T>replaceAll(jakarta.ws.rs.core.MultivaluedMap<String,Object> headers)Replaces all existing headers with the newly supplied headers.voidsetAllHeaders(jakarta.ws.rs.core.MultivaluedMap<String,String> values)voidsetEntityAnnotations(Annotation[] entityAnnotations)<Ret extends T>
RestResponse.ResponseBuilder<Ret>status(int status)Set the status on the ResponseBuilder.<Ret extends T>
RestResponse.ResponseBuilder<Ret>status(int status, String reasonPhrase)Set the status on the ResponseBuilder.RestResponse.ResponseBuilder<T>tag(jakarta.ws.rs.core.EntityTag tag)Set a response entity tag.RestResponse.ResponseBuilder<T>tag(String tag)Set a strong response entity tag.RestResponse.ResponseBuilder<T>type(jakarta.ws.rs.core.MediaType type)Set the message entity media type.RestResponse.ResponseBuilder<T>type(String type)Set the message entity media type.RestResponse.ResponseBuilder<T>variant(jakarta.ws.rs.core.Variant variant)Set message entity representation metadata.RestResponse.ResponseBuilder<T>variants(jakarta.ws.rs.core.Variant... variants)Add a Vary header that lists the available variants.RestResponse.ResponseBuilder<T>variants(List<jakarta.ws.rs.core.Variant> variants)Add a Vary header that lists the available variants.-
Methods inherited from class org.jboss.resteasy.reactive.RestResponse.ResponseBuilder
accepted, accepted, contentLocation, create, create, create, create, create, create, created, fromResponse, location, newInstance, noContent, notAcceptable, notFound, notModified, notModified, notModified, ok, ok, ok, ok, ok, seeOther, serverError, status, status, temporaryRedirect
-
-
-
-
Field Detail
-
status
protected int status
-
reasonPhrase
protected String reasonPhrase
-
entity
protected Object entity
-
metadata
protected MultivaluedTreeMap<String,Object> metadata
-
entityAnnotations
protected Annotation[] entityAnnotations
-
-
Method Detail
-
getDateFormatRFC822
public static SimpleDateFormat getDateFormatRFC822()
-
getStatus
public int getStatus()
-
getReasonPhrase
public String getReasonPhrase()
-
getEntity
public Object getEntity()
-
getEntityAnnotations
public Annotation[] getEntityAnnotations()
-
setEntityAnnotations
public void setEntityAnnotations(Annotation[] entityAnnotations)
-
build
public RestResponseImpl<T> build()
Description copied from class:RestResponse.ResponseBuilderCreate a RestResponse instance from the current ResponseBuilder. The builder is reset to a blank state equivalent to calling the ok method.- Specified by:
buildin classRestResponse.ResponseBuilder<T>- Returns:
- a RestResponse instance.
-
build
public RestResponseImpl<T> build(boolean copyHeaders)
-
populateResponse
public <OtherT extends RestResponseImpl<T>> OtherT populateResponse(OtherT response)
Populates a response with the standard data- Returns:
- The given response
-
populateResponse
public <OtherT extends RestResponseImpl<T>> OtherT populateResponse(OtherT response, boolean copyHeaders)
-
doClone
protected abstract AbstractRestResponseBuilder<T> doClone()
-
clone
public AbstractRestResponseBuilder<T> clone()
Description copied from class:RestResponse.ResponseBuilderCreate a copy of the ResponseBuilder preserving its state.
- Specified by:
clonein classRestResponse.ResponseBuilder<T>- Returns:
- a copy of the ResponseBuilder.
-
status
public <Ret extends T> RestResponse.ResponseBuilder<Ret> status(int status, String reasonPhrase)
Description copied from class:RestResponse.ResponseBuilderSet the status on the ResponseBuilder.- Specified by:
statusin classRestResponse.ResponseBuilder<T>- Parameters:
status- the response status.reasonPhrase- the reason phrase.- Returns:
- the updated response builder.
-
status
public <Ret extends T> RestResponse.ResponseBuilder<Ret> status(int status)
Description copied from class:RestResponse.ResponseBuilderSet the status on the ResponseBuilder.- Specified by:
statusin classRestResponse.ResponseBuilder<T>- Parameters:
status- the response status.- Returns:
- the updated response builder.
-
entity
public RestResponse.ResponseBuilder<T> entity(T entity)
Description copied from class:RestResponse.ResponseBuilderSet the response entity in the builder. Any Java type instance for a response entity, that is supported by the runtime can be passed. It is the callers responsibility to wrap the actual entity withGenericEntityif preservation of its generic type is required. Note that the entity can be also set as aninput stream. A specific entity media type can be set using one of thetype(...)methods.- Specified by:
entityin classRestResponse.ResponseBuilder<T>- Parameters:
entity- the request entity.- Returns:
- updated response builder instance.
- See Also:
RestResponse.ResponseBuilder.entity(java.lang.Object, java.lang.annotation.Annotation[]),RestResponse.ResponseBuilder.type(jakarta.ws.rs.core.MediaType),RestResponse.ResponseBuilder.type(java.lang.String)
-
entity
public RestResponse.ResponseBuilder<T> entity(T entity, Annotation[] annotations)
Description copied from class:RestResponse.ResponseBuilderSet the response entity in the builder. Any Java type instance for a response entity, that is supported by the runtime can be passed. It is the callers responsibility to wrap the actual entity withGenericEntityif preservation of its generic type is required. Note that the entity can be also set as aninput stream. A specific entity media type can be set using one of thetype(...)methods.- Specified by:
entityin classRestResponse.ResponseBuilder<T>- Parameters:
entity- the request entity.annotations- annotations that will be passed to theMessageBodyWriter, (in addition to any annotations declared directly on a resource method that returns the built response).- Returns:
- updated response builder instance.
- See Also:
RestResponse.ResponseBuilder.entity(java.lang.Object),RestResponse.ResponseBuilder.type(jakarta.ws.rs.core.MediaType),RestResponse.ResponseBuilder.type(java.lang.String)
-
type
public RestResponse.ResponseBuilder<T> type(jakarta.ws.rs.core.MediaType type)
Description copied from class:RestResponse.ResponseBuilderSet the message entity media type.- Specified by:
typein classRestResponse.ResponseBuilder<T>- Parameters:
type- the media type of the message entity. Ifnull, any existing value for type will be removed.- Returns:
- the updated response builder.
-
type
public RestResponse.ResponseBuilder<T> type(String type)
Description copied from class:RestResponse.ResponseBuilderSet the message entity media type.- Specified by:
typein classRestResponse.ResponseBuilder<T>- Parameters:
type- the media type of the message entity. Ifnull, any existing value for type will be removed.- Returns:
- the updated response builder.
-
variant
public RestResponse.ResponseBuilder<T> variant(jakarta.ws.rs.core.Variant variant)
Description copied from class:RestResponse.ResponseBuilderSet message entity representation metadata. Equivalent to setting the values of content type, content language, and content encoding separately using the values of the variant properties.- Specified by:
variantin classRestResponse.ResponseBuilder<T>- Parameters:
variant- metadata of the message entity, anullvalue is equivalent to a variant with allnullproperties.- Returns:
- the updated response builder.
- See Also:
RestResponse.ResponseBuilder.encoding(java.lang.String),RestResponse.ResponseBuilder.language(java.util.Locale),RestResponse.ResponseBuilder.type(jakarta.ws.rs.core.MediaType)
-
variants
public RestResponse.ResponseBuilder<T> variants(List<jakarta.ws.rs.core.Variant> variants)
Description copied from class:RestResponse.ResponseBuilderAdd a Vary header that lists the available variants.- Specified by:
variantsin classRestResponse.ResponseBuilder<T>- Parameters:
variants- a list of available representation variants, anullvalue will remove an existing value for Vary header.- Returns:
- the updated response builder.
-
language
public RestResponse.ResponseBuilder<T> language(String language)
Description copied from class:RestResponse.ResponseBuilderSet the message entity language.- Specified by:
languagein classRestResponse.ResponseBuilder<T>- Parameters:
language- the language of the message entity, ifnullany existing value for language will be removed.- Returns:
- the updated response builder.
-
tag
public RestResponse.ResponseBuilder<T> tag(jakarta.ws.rs.core.EntityTag tag)
Description copied from class:RestResponse.ResponseBuilderSet a response entity tag.- Specified by:
tagin classRestResponse.ResponseBuilder<T>- Parameters:
tag- the entity tag, ifnullany existing entity tag value will be removed.- Returns:
- the updated response builder.
-
tag
public RestResponse.ResponseBuilder<T> tag(String tag)
Description copied from class:RestResponse.ResponseBuilderSet a strong response entity tag. This is a shortcut fortag(new EntityTag(value)).- Specified by:
tagin classRestResponse.ResponseBuilder<T>- Parameters:
tag- the string content of a strong entity tag. The runtime will quote the supplied value when creating the header. Ifnullany existing entity tag value will be removed.- Returns:
- the updated response builder.
-
lastModified
public RestResponse.ResponseBuilder<T> lastModified(Date lastModified)
Description copied from class:RestResponse.ResponseBuilderSet the response entity last modification date.- Specified by:
lastModifiedin classRestResponse.ResponseBuilder<T>- Parameters:
lastModified- the last modified date, ifnullany existing last modified value will be removed.- Returns:
- the updated response builder.
-
cacheControl
public RestResponse.ResponseBuilder<T> cacheControl(jakarta.ws.rs.core.CacheControl cacheControl)
Description copied from class:RestResponse.ResponseBuilderSet the cache control data of the message.- Specified by:
cacheControlin classRestResponse.ResponseBuilder<T>- Parameters:
cacheControl- the cache control directives, ifnullany existing cache control directives will be removed.- Returns:
- the updated response builder.
-
header
public RestResponse.ResponseBuilder<T> header(String name, Object value)
Description copied from class:RestResponse.ResponseBuilderAdd an arbitrary header.- Specified by:
headerin classRestResponse.ResponseBuilder<T>- Parameters:
name- the name of the headervalue- the value of the header, the header will be serialized using aRuntimeDelegate.HeaderDelegateif one is available viaRuntimeDelegate.createHeaderDelegate(java.lang.Class)for the class ofvalueor using itstoStringmethod if a header delegate is not available. Ifvalueisnullthen all current headers of the same name will be removed.- Returns:
- the updated response builder.
-
cookie
public RestResponse.ResponseBuilder<T> cookie(jakarta.ws.rs.core.NewCookie... cookies)
Description copied from class:RestResponse.ResponseBuilderAdd cookies to the response message.- Specified by:
cookiein classRestResponse.ResponseBuilder<T>- Parameters:
cookies- new cookies that will accompany the response. Anullvalue will remove all cookies, including those added via theRestResponse.ResponseBuilder.header(java.lang.String, java.lang.Object)method.- Returns:
- the updated response builder.
-
language
public RestResponse.ResponseBuilder<T> language(Locale language)
Description copied from class:RestResponse.ResponseBuilderSet the message entity language.- Specified by:
languagein classRestResponse.ResponseBuilder<T>- Parameters:
language- the language of the message entity, ifnullany existing value for type will be removed.- Returns:
- the updated response builder.
-
expires
public RestResponse.ResponseBuilder<T> expires(Date expires)
Description copied from class:RestResponse.ResponseBuilderSet the response expiration date.- Specified by:
expiresin classRestResponse.ResponseBuilder<T>- Parameters:
expires- the expiration date, ifnullremoves any existing expires value.- Returns:
- the updated response builder.
-
allow
public RestResponse.ResponseBuilder<T> allow(String... methods)
Description copied from class:RestResponse.ResponseBuilderSet the list of allowed methods for the resource. Any duplicate method names will be truncated to a single entry.- Specified by:
allowin classRestResponse.ResponseBuilder<T>- Parameters:
methods- the methods to be listed as allowed for the resource, ifnullany existing allowed method list will be removed.- Returns:
- the updated response builder.
-
allow
public RestResponse.ResponseBuilder<T> allow(Set<String> methods)
Description copied from class:RestResponse.ResponseBuilderSet the list of allowed methods for the resource.- Specified by:
allowin classRestResponse.ResponseBuilder<T>- Parameters:
methods- the methods to be listed as allowed for the resource, ifnullany existing allowed method list will be removed.- Returns:
- the updated response builder.
-
encoding
public RestResponse.ResponseBuilder<T> encoding(String encoding)
Description copied from class:RestResponse.ResponseBuilderSet the message entity content encoding.- Specified by:
encodingin classRestResponse.ResponseBuilder<T>- Parameters:
encoding- the content encoding of the message entity, ifnullany existing value for content encoding will be removed.- Returns:
- the updated response builder.
-
variants
public RestResponse.ResponseBuilder<T> variants(jakarta.ws.rs.core.Variant... variants)
Description copied from class:RestResponse.ResponseBuilderAdd a Vary header that lists the available variants.- Specified by:
variantsin classRestResponse.ResponseBuilder<T>- Parameters:
variants- a list of available representation variants, anullvalue will remove an existing value for Vary header.- Returns:
- the updated response builder.
-
links
public RestResponse.ResponseBuilder<T> links(jakarta.ws.rs.core.Link... links)
Description copied from class:RestResponse.ResponseBuilderAdd one or more link headers.- Specified by:
linksin classRestResponse.ResponseBuilder<T>- Parameters:
links- links to be added to the message as headers, anullvalue will remove any existing Link headers.- Returns:
- the updated response builder.
-
link
public RestResponse.ResponseBuilder<T> link(URI uri, String rel)
Description copied from class:RestResponse.ResponseBuilderAdd a link header.- Specified by:
linkin classRestResponse.ResponseBuilder<T>- Parameters:
uri- underlying URI for link header.rel- value of "rel" parameter.- Returns:
- the updated response builder.
-
link
public RestResponse.ResponseBuilder<T> link(String uri, String rel)
Description copied from class:RestResponse.ResponseBuilderAdd a link header.- Specified by:
linkin classRestResponse.ResponseBuilder<T>- Parameters:
uri- underlying URI for link header.rel- value of "rel" parameter.- Returns:
- the updated response builder.
-
replaceAll
public RestResponse.ResponseBuilder<T> replaceAll(jakarta.ws.rs.core.MultivaluedMap<String,Object> headers)
Description copied from class:RestResponse.ResponseBuilderReplaces all existing headers with the newly supplied headers.- Specified by:
replaceAllin classRestResponse.ResponseBuilder<T>- Parameters:
headers- new headers to be set, ifnullall existing headers will be removed.- Returns:
- the updated response builder.
-
-