org.jboss.resteasy.specimpl
Class ResponseBuilderImpl

java.lang.Object
  extended by javax.ws.rs.core.Response.ResponseBuilder
      extended by org.jboss.resteasy.specimpl.ResponseBuilderImpl

public class ResponseBuilderImpl
extends Response.ResponseBuilder

Version:
$Revision: 1 $
Author:
Bill Burke

Constructor Summary
ResponseBuilderImpl()
           
 
Method Summary
 Response build()
          Create a Response instance from the current ResponseBuilder.
 Response.ResponseBuilder cacheControl(CacheControl cacheControl)
          Set the cache control data on the ResponseBuilder.
 Response.ResponseBuilder clone()
          Create a copy of the ResponseBuilder preserving its state.
 Response.ResponseBuilder contentLocation(java.net.URI location)
          Set the content location on the ResponseBuilder.
 Response.ResponseBuilder cookie(NewCookie... cookies)
          Add cookies to the ResponseBuilder.
static java.lang.String createVaryHeader(java.util.List<Variant> variants)
           
 Response.ResponseBuilder entity(java.lang.Object entity)
          Set the entity on the ResponseBuilder.
 Response.ResponseBuilder expires(java.util.Date expires)
          Set the expires date on the ResponseBuilder.
 Response.ResponseBuilder header(java.lang.String name, java.lang.Object value)
          Add a header to the ResponseBuilder.
 Response.ResponseBuilder language(java.util.Locale language)
          Set the language on the ResponseBuilder.
 Response.ResponseBuilder language(java.lang.String language)
          Set the language on the ResponseBuilder.
 Response.ResponseBuilder lastModified(java.util.Date lastModified)
          Set the last modified date on the ResponseBuilder.
 Response.ResponseBuilder location(java.net.URI location)
          Set the location on the ResponseBuilder.
 Response.ResponseBuilder status(int status)
          Set the status on the ResponseBuilder.
 Response.ResponseBuilder tag(EntityTag tag)
          Set an entity tag on the ResponseBuilder.
 Response.ResponseBuilder tag(java.lang.String tag)
          Set a strong entity tag on the ResponseBuilder.
 Response.ResponseBuilder type(MediaType type)
          Set the response media type on the ResponseBuilder.
 Response.ResponseBuilder type(java.lang.String type)
          Set the response media type on the ResponseBuilder.
 Response.ResponseBuilder variant(Variant variant)
          Set representation metadata on the ResponseBuilder.
 Response.ResponseBuilder variants(java.util.List<Variant> variants)
          Add a Vary header that lists the available variants.
 
Methods inherited from class javax.ws.rs.core.Response.ResponseBuilder
newInstance, status, status
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResponseBuilderImpl

public ResponseBuilderImpl()
Method Detail

build

public Response build()
Description copied from class: Response.ResponseBuilder
Create a Response instance from the current ResponseBuilder. The builder is reset to a blank state equivalent to calling the ok method.

Specified by:
build in class Response.ResponseBuilder
Returns:
a Response instance

clone

public Response.ResponseBuilder clone()
Description copied from class: Response.ResponseBuilder
Create a copy of the ResponseBuilder preserving its state.

Specified by:
clone in class Response.ResponseBuilder
Returns:
a copy of the ResponseBuilder

status

public Response.ResponseBuilder status(int status)
Description copied from class: Response.ResponseBuilder
Set the status on the ResponseBuilder.

Specified by:
status in class Response.ResponseBuilder
Parameters:
status - the response status
Returns:
the updated ResponseBuilder

entity

public Response.ResponseBuilder entity(java.lang.Object entity)
Description copied from class: Response.ResponseBuilder
Set the entity on the ResponseBuilder. It is the callers responsibility to wrap the actual entity with GenericEntity if preservation of its generic type is required.

Specified by:
entity in class Response.ResponseBuilder
Parameters:
entity - the response entity
Returns:
the updated ResponseBuilder

type

public Response.ResponseBuilder type(MediaType type)
Description copied from class: Response.ResponseBuilder
Set the response media type on the ResponseBuilder.

Specified by:
type in class Response.ResponseBuilder
Parameters:
type - the media type of the response entity, if null any existing value for type will be removed
Returns:
the updated ResponseBuilder

type

public Response.ResponseBuilder type(java.lang.String type)
Description copied from class: Response.ResponseBuilder
Set the response media type on the ResponseBuilder.

Specified by:
type in class Response.ResponseBuilder
Parameters:
type - the media type of the response entity, if null any existing value for type will be removed
Returns:
the updated ResponseBuilder

variant

public Response.ResponseBuilder variant(Variant variant)
Description copied from class: Response.ResponseBuilder
Set representation metadata on the ResponseBuilder. Equivalent to setting the values of content type, content language, and content encoding separately using the values of the variant properties.

Specified by:
variant in class Response.ResponseBuilder
Parameters:
variant - metadata of the response entity, a null value is equivalent to a variant with all null properties.
Returns:
the updated ResponseBuilder

variants

public Response.ResponseBuilder variants(java.util.List<Variant> variants)
Description copied from class: Response.ResponseBuilder
Add a Vary header that lists the available variants.

Specified by:
variants in class Response.ResponseBuilder
Parameters:
variants - a list of available representation variants, a null value will remove an existing value for vary.
Returns:
the updated ResponseBuilder

createVaryHeader

public static java.lang.String createVaryHeader(java.util.List<Variant> variants)

language

public Response.ResponseBuilder language(java.lang.String language)
Description copied from class: Response.ResponseBuilder
Set the language on the ResponseBuilder.

Specified by:
language in class Response.ResponseBuilder
Parameters:
language - the language of the response entity, if null any existing value for language will be removed
Returns:
the updated ResponseBuilder

location

public Response.ResponseBuilder location(java.net.URI location)
Description copied from class: Response.ResponseBuilder
Set the location on the ResponseBuilder.

Specified by:
location in class Response.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 (see UriInfo.getBaseUri()). If null any existing value for location will be removed.
Returns:
the updated ResponseBuilder

contentLocation

public Response.ResponseBuilder contentLocation(java.net.URI location)
Description copied from class: Response.ResponseBuilder
Set the content location on the ResponseBuilder.

Specified by:
contentLocation in class Response.ResponseBuilder
Parameters:
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.
Returns:
the updated ResponseBuilder

tag

public Response.ResponseBuilder tag(EntityTag tag)
Description copied from class: Response.ResponseBuilder
Set an entity tag on the ResponseBuilder.

Specified by:
tag in class Response.ResponseBuilder
Parameters:
tag - the entity tag, if null any existing entity tag value will be removed.
Returns:
the updated ResponseBuilder

tag

public Response.ResponseBuilder tag(java.lang.String tag)
Description copied from class: Response.ResponseBuilder
Set a strong entity tag on the ResponseBuilder. This is a shortcut for tag(new EntityTag(value)).

Specified by:
tag in class Response.ResponseBuilder
Parameters:
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.
Returns:
the updated ResponseBuilder

lastModified

public Response.ResponseBuilder lastModified(java.util.Date lastModified)
Description copied from class: Response.ResponseBuilder
Set the last modified date on the ResponseBuilder.

Specified by:
lastModified in class Response.ResponseBuilder
Parameters:
lastModified - the last modified date, if null any existing last modified value will be removed.
Returns:
the updated ResponseBuilder

cacheControl

public Response.ResponseBuilder cacheControl(CacheControl cacheControl)
Description copied from class: Response.ResponseBuilder
Set the cache control data on the ResponseBuilder.

Specified by:
cacheControl in class Response.ResponseBuilder
Parameters:
cacheControl - the cache control directives, if null removes any existing cache control directives.
Returns:
the updated ResponseBuilder

header

public Response.ResponseBuilder header(java.lang.String name,
                                       java.lang.Object value)
Description copied from class: Response.ResponseBuilder
Add a header to the ResponseBuilder.

Specified by:
header in class Response.ResponseBuilder
Parameters:
name - the name of the header
value - 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.
Returns:
the updated ResponseBuilder

cookie

public Response.ResponseBuilder cookie(NewCookie... cookies)
Description copied from class: Response.ResponseBuilder
Add cookies to the ResponseBuilder.

Specified by:
cookie in class Response.ResponseBuilder
Parameters:
cookies - 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.
Returns:
the updated ResponseBuilder

language

public Response.ResponseBuilder language(java.util.Locale language)
Description copied from class: Response.ResponseBuilder
Set the language on the ResponseBuilder.

Specified by:
language in class Response.ResponseBuilder
Parameters:
language - the language of the response entity, if null any existing value for type will be removed
Returns:
the updated ResponseBuilder

expires

public Response.ResponseBuilder expires(java.util.Date expires)
Description copied from class: Response.ResponseBuilder
Set the expires date on the ResponseBuilder.

Specified by:
expires in class Response.ResponseBuilder
Parameters:
expires - the expiration date, if null removes any existing expires value.
Returns:
the updated ResponseBuilder


Copyright © 2010. All Rights Reserved.