Class ResponseBuilderImpl
- Version:
- $Revision: 1 $
- Author:
- Bill Burke
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Objectprotected Annotation[]protected Stringprotected int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionSet the list of allowed methods for the resource.Set the list of allowed methods for the resource.build()Create a Response instance from the current ResponseBuilder.cacheControl(CacheControl cacheControl) Set the cache control data of the message.clone()contentLocation(URI location) Set the content location.Add cookies to the response message.static StringcreateVaryHeader(List<Variant> variants) Set the message entity content encoding.Set the response entity in the builder.entity(Object entity, Annotation[] annotations) Set the response entity in the builder.Set the response expiration date.static SimpleDateFormatAdd an arbitrary header.Set the message entity language.Set the message entity language.lastModified(Date lastModified) Set the response entity last modification date.Add a link header.Add a link header.Add one or more link headers.Set the location.replaceAll(MultivaluedMap<String, Object> headers) Replaces all existing headers with the newly supplied headers.status(int status) Set the status on the ResponseBuilder.Set the status on the ResponseBuilder.Set a response entity tag.Set a strong response entity tag.Set the message entity media type.Set the message entity media type.Set message entity representation metadata.Add a Vary header that lists the available variants.Add a Vary header that lists the available variants.Methods inherited from class jakarta.ws.rs.core.Response.ResponseBuilder
newInstance, status, status
-
Field Details
-
entity
-
entityAnnotations
-
status
protected int status -
reasonPhrase
-
metadata
-
-
Constructor Details
-
ResponseBuilderImpl
public ResponseBuilderImpl()
-
-
Method Details
-
build
Description copied from class:Response.ResponseBuilderCreate a Response instance from the current ResponseBuilder. The builder is reset to a blank state equivalent to calling the ok method.- Specified by:
buildin classResponse.ResponseBuilder- Returns:
- a Response instance.
-
clone
Description copied from class:Response.ResponseBuilderCreate a copy of the ResponseBuilder preserving its state.
- Specified by:
clonein classResponse.ResponseBuilder- Returns:
- a copy of the ResponseBuilder.
-
status
Description copied from class:Response.ResponseBuilderSet the status on the ResponseBuilder.- Specified by:
statusin classResponse.ResponseBuilder- Parameters:
status- the response status.reasonPhrase- the reason phrase.- Returns:
- the updated response builder.
-
status
Description copied from class:Response.ResponseBuilderSet the status on the ResponseBuilder.- Specified by:
statusin classResponse.ResponseBuilder- Parameters:
status- the response status.- Returns:
- the updated response builder.
-
entity
Description copied from class:Response.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 with
A specific entity media type can be set using one of theGenericEntityif preservation of its generic type is required. Note that the entity can be also set as aninput stream.type(...)methods.- Specified by:
entityin classResponse.ResponseBuilder- Parameters:
entity- the request entity.- Returns:
- updated response builder instance.
- See Also:
-
entity
Description copied from class:Response.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 with
A specific entity media type can be set using one of theGenericEntityif preservation of its generic type is required. Note that the entity can be also set as aninput stream.type(...)methods.- Specified by:
entityin classResponse.ResponseBuilder- 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:
-
type
Description copied from class:Response.ResponseBuilderSet the message entity media type.- Specified by:
typein classResponse.ResponseBuilder- Parameters:
type- the media type of the message entity. Ifnull, any existing value for type will be removed.- Returns:
- the updated response builder.
-
type
Description copied from class:Response.ResponseBuilderSet the message entity media type.- Specified by:
typein classResponse.ResponseBuilder- Parameters:
type- the media type of the message entity. Ifnull, any existing value for type will be removed.- Returns:
- the updated response builder.
-
variant
Description copied from class:Response.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 classResponse.ResponseBuilder- Parameters:
variant- metadata of the message entity, anullvalue is equivalent to a variant with allnullproperties.- Returns:
- the updated response builder.
- See Also:
-
variants
Description copied from class:Response.ResponseBuilderAdd a Vary header that lists the available variants.- Specified by:
variantsin classResponse.ResponseBuilder- Parameters:
variants- a list of available representation variants, anullvalue will remove an existing value for Vary header.- Returns:
- the updated response builder.
-
createVaryHeader
-
language
Description copied from class:Response.ResponseBuilderSet the message entity language.- Specified by:
languagein classResponse.ResponseBuilder- Parameters:
language- the language of the message entity, ifnullany existing value for language will be removed.- Returns:
- the updated response builder.
-
location
Description copied from class:Response.ResponseBuilderSet the location.- Specified by:
locationin classResponse.ResponseBuilder- Parameters:
location- 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 (seeUriInfo.getBaseUri()). Ifnullany existing value for location will be removed.- Returns:
- the updated response builder.
-
contentLocation
Description copied from class:Response.ResponseBuilderSet the content location.- Specified by:
contentLocationin classResponse.ResponseBuilder- Parameters:
location- the content location. Relative or absolute URIs may be used for the value of content location. Ifnullany existing value for content location will be removed.- Returns:
- the updated response builder.
-
tag
Description copied from class:Response.ResponseBuilderSet a response entity tag.- Specified by:
tagin classResponse.ResponseBuilder- Parameters:
tag- the entity tag, ifnullany existing entity tag value will be removed.- Returns:
- the updated response builder.
-
tag
Description copied from class:Response.ResponseBuilderSet a strong response entity tag.
This is a shortcut fortag(new EntityTag(value)).- Specified by:
tagin classResponse.ResponseBuilder- Parameters:
tag- the string content of a strong entity tag. The JAX-RS runtime will quote the supplied value when creating the header. Ifnullany existing entity tag value will be removed.- Returns:
- the updated response builder.
-
lastModified
Description copied from class:Response.ResponseBuilderSet the response entity last modification date.- Specified by:
lastModifiedin classResponse.ResponseBuilder- Parameters:
lastModified- the last modified date, ifnullany existing last modified value will be removed.- Returns:
- the updated response builder.
-
cacheControl
Description copied from class:Response.ResponseBuilderSet the cache control data of the message.- Specified by:
cacheControlin classResponse.ResponseBuilder- Parameters:
cacheControl- the cache control directives, ifnullany existing cache control directives will be removed.- Returns:
- the updated response builder.
-
header
Description copied from class:Response.ResponseBuilderAdd an arbitrary header.- Specified by:
headerin classResponse.ResponseBuilder- 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
Description copied from class:Response.ResponseBuilderAdd cookies to the response message.- Specified by:
cookiein classResponse.ResponseBuilder- Parameters:
cookies- new cookies that will accompany the response. Anullvalue will remove all cookies, including those added via theResponse.ResponseBuilder.header(java.lang.String, java.lang.Object)method.- Returns:
- the updated response builder.
-
language
Description copied from class:Response.ResponseBuilderSet the message entity language.- Specified by:
languagein classResponse.ResponseBuilder- Parameters:
language- the language of the message entity, ifnullany existing value for type will be removed.- Returns:
- the updated response builder.
-
getDateFormatRFC822
-
expires
Description copied from class:Response.ResponseBuilderSet the response expiration date.- Specified by:
expiresin classResponse.ResponseBuilder- Parameters:
expires- the expiration date, ifnullremoves any existing expires value.- Returns:
- the updated response builder.
-
allow
Description copied from class:Response.ResponseBuilderSet the list of allowed methods for the resource. Any duplicate method names will be truncated to a single entry.- Specified by:
allowin classResponse.ResponseBuilder- 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
Description copied from class:Response.ResponseBuilderSet the list of allowed methods for the resource.- Specified by:
allowin classResponse.ResponseBuilder- 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
Description copied from class:Response.ResponseBuilderSet the message entity content encoding.- Specified by:
encodingin classResponse.ResponseBuilder- Parameters:
encoding- the content encoding of the message entity, ifnullany existing value for content encoding will be removed.- Returns:
- the updated response builder.
-
variants
Description copied from class:Response.ResponseBuilderAdd a Vary header that lists the available variants.- Specified by:
variantsin classResponse.ResponseBuilder- Parameters:
variants- a list of available representation variants, anullvalue will remove an existing value for Vary header.- Returns:
- the updated response builder.
-
links
Description copied from class:Response.ResponseBuilderAdd one or more link headers.- Specified by:
linksin classResponse.ResponseBuilder- Parameters:
links- links to be added to the message as headers, anullvalue will remove any existing Link headers.- Returns:
- the updated response builder.
-
link
Description copied from class:Response.ResponseBuilderAdd a link header.- Specified by:
linkin classResponse.ResponseBuilder- Parameters:
uri- underlying URI for link header.rel- value of "rel" parameter.- Returns:
- the updated response builder.
-
link
Description copied from class:Response.ResponseBuilderAdd a link header.- Specified by:
linkin classResponse.ResponseBuilder- Parameters:
uri- underlying URI for link header.rel- value of "rel" parameter.- Returns:
- the updated response builder.
-
replaceAll
Description copied from class:Response.ResponseBuilderReplaces all existing headers with the newly supplied headers.- Specified by:
replaceAllin classResponse.ResponseBuilder- Parameters:
headers- new headers to be set, ifnullall existing headers will be removed.- Returns:
- the updated response builder.
-