com.sun.jersey.core.spi.factory
Class ResponseImpl

java.lang.Object
  extended by javax.ws.rs.core.Response
      extended by com.sun.jersey.core.spi.factory.ResponseImpl
Direct Known Subclasses:
JResponseAsResponse

public class ResponseImpl
extends Response

An implementation of Response.

This implementation supports the declaration of an entity type that will be utilized when a MessageBodyWriter is selected to write out the entity.

Author:
[email protected]

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.ws.rs.core.Response
Response.ResponseBuilder, Response.Status, Response.StatusType
 
Constructor Summary
protected ResponseImpl(int status, OutBoundHeaders headers, java.lang.Object entity, java.lang.reflect.Type entityType)
          Construct given a status, entity and metadata.
protected ResponseImpl(Response.StatusType statusType, OutBoundHeaders headers, java.lang.Object entity, java.lang.reflect.Type entityType)
          Construct given a status type, entity and metadata.
 
Method Summary
 java.lang.Object getEntity()
          Return the response entity.
 java.lang.reflect.Type getEntityType()
          Get the entity type.
 MultivaluedMap<java.lang.String,java.lang.Object> getMetadata()
          Get metadata associated with the response as a map.
 int getStatus()
          Get the status code associated with the response.
 Response.StatusType getStatusType()
          Get the status type.
static Response.Status.Family toFamilyCode(int statusCode)
           
static Response.StatusType toStatusType(int statusCode)
           
 
Methods inherited from class javax.ws.rs.core.Response
created, fromResponse, noContent, notAcceptable, notModified, notModified, notModified, ok, ok, ok, ok, ok, seeOther, serverError, status, status, status, temporaryRedirect
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResponseImpl

protected ResponseImpl(Response.StatusType statusType,
                       OutBoundHeaders headers,
                       java.lang.Object entity,
                       java.lang.reflect.Type entityType)
Construct given a status type, entity and metadata.

Parameters:
statusType - the status type
headers - the metadata, it is the callers responsibility to copy the metadata if necessary.
entity - the entity
entityType - the entity type, it is the callers responsibility to ensure the entity type is compatible with the entity.

ResponseImpl

protected ResponseImpl(int status,
                       OutBoundHeaders headers,
                       java.lang.Object entity,
                       java.lang.reflect.Type entityType)
Construct given a status, entity and metadata.

Parameters:
status - the status
headers - the metadata, it is the callers responsibility to copy the metadata if necessary.
entity - the entity
entityType - the entity type, it is the callers responsibility to ensure the entity type is compatible with the entity.
Method Detail

getStatusType

public Response.StatusType getStatusType()
Get the status type.

Returns:
the status type.

getEntityType

public java.lang.reflect.Type getEntityType()
Get the entity type.

Returns:
the entity type.

getStatus

public int getStatus()
Description copied from class: Response
Get the status code associated with the response.

Specified by:
getStatus in class Response
Returns:
the response status code or -1 if the status was not set.

getMetadata

public MultivaluedMap<java.lang.String,java.lang.Object> getMetadata()
Description copied from class: Response
Get metadata associated with the response as a map. The returned map may be subsequently modified by the JAX-RS runtime. Values will be serialized using a RuntimeDelegate.HeaderDelegate if one is available via RuntimeDelegate.createHeaderDelegate(java.lang.Class) for the class of the value or using the values toString method if a header delegate is not available.

Specified by:
getMetadata in class Response
Returns:
response metadata as a map

getEntity

public java.lang.Object getEntity()
Description copied from class: Response
Return the response entity. The response will be serialized using a MessageBodyWriter for either the class of the entity or, in the case of GenericEntity, the value of GenericEntity.getRawType().

Specified by:
getEntity in class Response
Returns:
an object instance or null if there is no entity
See Also:
MessageBodyWriter

toStatusType

public static Response.StatusType toStatusType(int statusCode)

toFamilyCode

public static Response.Status.Family toFamilyCode(int statusCode)


Copyright © 2010 Oracle Corporation. All Rights Reserved.