|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.jersey.api.JResponse.AJResponseBuilder<E,B>
E - The entity typeB - The builder typepublic abstract static class JResponse.AJResponseBuilder<E,B extends JResponse.AJResponseBuilder>
An abstract response builder that may be utilized to extend
response building and the construction of JResponse
instances.
| Field Summary | |
|---|---|
protected E |
entity
The entity. |
protected OutBoundHeaders |
headers
The response metadata. |
protected Response.StatusType |
statusType
The status type. |
| Constructor Summary | |
|---|---|
protected |
JResponse.AJResponseBuilder()
Default constructor. |
protected |
JResponse.AJResponseBuilder(JResponse.AJResponseBuilder<E,?> that)
Construct a shallow copy. |
| Method Summary | |
|---|---|
B |
cacheControl(CacheControl cacheControl)
Set the cache control. |
B |
contentLocation(java.net.URI location)
Set the content location. |
B |
cookie(NewCookie... cookies)
Add cookies. |
B |
encoding(java.lang.String encoding)
Set the content encoding. |
B |
entity(E entity)
Set the entity. |
B |
expires(java.util.Date expires)
Set the expires date. |
protected E |
getEntity()
Get the response entity. |
protected OutBoundHeaders |
getMetadata()
Get the metadata associated with the response. |
protected int |
getStatus()
Get the status code associated with the response. |
protected Response.StatusType |
getStatusType()
Get the status type associated with the response. |
B |
header(java.lang.String name,
java.lang.Object value)
Add a header. |
B |
header(java.lang.String name,
java.lang.Object value,
boolean single)
Add a header. |
B |
headerSingle(java.lang.String name,
java.lang.Object value)
Add a header or replace an existing header. |
B |
language(java.util.Locale language)
Set the language. |
B |
language(java.lang.String language)
Set the language. |
B |
lastModified(java.util.Date lastModified)
Set the last modified date. |
B |
location(java.net.URI location)
Set the location. |
protected void |
reset()
Reset to the default state. |
B |
status(int status)
Set the status. |
B |
status(Response.Status status)
Set the status. |
B |
status(Response.StatusType status)
Set the status. |
B |
tag(EntityTag tag)
Set an entity tag. |
B |
tag(java.lang.String tag)
Set a strong entity tag. |
B |
type(MediaType type)
Set the response media type. |
B |
type(java.lang.String type)
Set the response media type. |
B |
variant(Variant variant)
Set representation metadata. |
B |
variants(java.util.List<Variant> variants)
Add a Vary header that lists the available variants. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected Response.StatusType statusType
protected OutBoundHeaders headers
protected E entity
| Constructor Detail |
|---|
protected JResponse.AJResponseBuilder()
protected JResponse.AJResponseBuilder(JResponse.AJResponseBuilder<E,?> that)
that - the AJResponseBuilder to copy from.| Method Detail |
|---|
protected void reset()
protected Response.StatusType getStatusType()
protected int getStatus()
protected OutBoundHeaders getMetadata()
protected E getEntity()
public B status(int status)
status - the response status
java.lang.IllegalArgumentException - if status is less than 100 or greater
than 599.public B status(Response.StatusType status)
status - the response status
java.lang.IllegalArgumentException - if status is nullpublic B status(Response.Status status)
status - the response status
java.lang.IllegalArgumentException - if status is nullpublic B entity(E entity)
entity - the response entity
public B type(MediaType type)
type - the media type of the response entity, if null any
existing value for type will be removed
public B type(java.lang.String type)
type - the media type of the response entity, if null any
existing value for type will be removed
java.lang.IllegalArgumentException - if type cannot be parsedpublic B variant(Variant variant)
variant - metadata of the response entity, a null value is
equivalent to a variant with all null properties.
public B variants(java.util.List<Variant> variants)
variants - a list of available representation variants, a null
value will remove an existing value for vary.
public B language(java.lang.String language)
language - the language of the response entity, if null any
existing value for language will be removed
public B language(java.util.Locale language)
language - the language of the response entity, if null any
existing value for type will be removed
public B location(java.net.URI location)
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 (see
UriInfo#getBaseUri). If null any
existing value for location will be removed.
public B contentLocation(java.net.URI location)
location - 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 B encoding(java.lang.String encoding)
encoding - the content encoding of the response entity, if null
any existing value for type will be removed
public B tag(EntityTag tag)
tag - the entity tag, if null any
existing entity tag value will be removed.
public B tag(java.lang.String tag)
tag(new EntityTag(value)).
tag - 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 B lastModified(java.util.Date lastModified)
lastModified - the last modified date, if null any existing
last modified value will be removed.
public B cacheControl(CacheControl cacheControl)
cacheControl - the cache control directives, if null removes any
existing cache control directives.
public B expires(java.util.Date expires)
expires - the expiration date, if null removes any existing
expires value.
public B cookie(NewCookie... cookies)
cookies - new cookies that will accompany the response. A null
value will remove all cookies, including those added via the
header(java.lang.String, java.lang.Object) method.
public B header(java.lang.String name,
java.lang.Object value)
name - 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 B headerSingle(java.lang.String name,
java.lang.Object value)
name - 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 B header(java.lang.String name,
java.lang.Object value,
boolean single)
name - 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.single - if true then replace the header if it exists, otherwise
add the header.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||