org.jboss.resteasy.core
Class ServerResponse

java.lang.Object
  extended by javax.ws.rs.core.Response
      extended by org.jboss.resteasy.core.ServerResponse

public class ServerResponse
extends Response

Version:
$Revision: 1 $
Author:
Bill Burke

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.ws.rs.core.Response
Response.ResponseBuilder, Response.Status, Response.StatusType
 
Field Summary
protected  Annotation[] annotations
           
protected  Object entity
           
protected  Type genericType
           
protected  boolean headersCommitted
           
protected  MessageBodyWriterInterceptor[] messageBodyWriterInterceptors
           
protected  Headers<Object> metadata
           
protected  PostProcessInterceptor[] postProcessInterceptors
           
protected  Class resourceClass
           
protected  Method resourceMethod
           
protected  int status
           
 
Constructor Summary
ServerResponse()
           
ServerResponse(Object entity, int status, Headers<Object> metadata)
           
 
Method Summary
 void commitHeaders(HttpResponse response)
           
static ServerResponse copyIfNotServerResponse(Response response)
           
 Annotation[] getAnnotations()
           
 Object getEntity()
          Return the response entity.
 Type getGenericType()
           
 MessageBodyWriterInterceptor[] getMessageBodyWriterInterceptors()
           
 MultivaluedMap<String,Object> getMetadata()
          Get metadata associated with the response as a map.
 PostProcessInterceptor[] getPostProcessInterceptors()
           
 Class getResourceClass()
          Resource class.
 Method getResourceMethod()
          JAX-RS method invoked on.
 int getStatus()
          Get the status code associated with the response.
 MediaType resolveContentType()
           
 void setAnnotations(Annotation[] annotations)
           
 void setEntity(Object entity)
           
 void setGenericType(Type genericType)
           
 void setMessageBodyWriterInterceptors(MessageBodyWriterInterceptor[] messageBodyWriterInterceptors)
           
 void setMetadata(MultivaluedMap<String,Object> metadata)
           
 void setPostProcessInterceptors(PostProcessInterceptor[] postProcessInterceptors)
           
 void setResourceClass(Class resourceClass)
           
 void setResourceMethod(Method resourceMethod)
           
 void setStatus(int status)
           
 void writeTo(HttpRequest request, HttpResponse response, ResteasyProviderFactory providerFactory)
          If there is an entity, headers are not converted to a string and set on the HttpResponse until the output stream is written to.
 
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
 

Field Detail

entity

protected Object entity

status

protected int status

metadata

protected Headers<Object> metadata

annotations

protected Annotation[] annotations

genericType

protected Type genericType

postProcessInterceptors

protected PostProcessInterceptor[] postProcessInterceptors

messageBodyWriterInterceptors

protected MessageBodyWriterInterceptor[] messageBodyWriterInterceptors

resourceMethod

protected Method resourceMethod

resourceClass

protected Class resourceClass

headersCommitted

protected boolean headersCommitted
Constructor Detail

ServerResponse

public ServerResponse(Object entity,
                      int status,
                      Headers<Object> metadata)

ServerResponse

public ServerResponse()
Method Detail

copyIfNotServerResponse

public static ServerResponse copyIfNotServerResponse(Response response)

getResourceMethod

public Method getResourceMethod()
JAX-RS method invoked on. FYI, this method may return null, specifically within the context of an async HTTP request as contextual information is not available to the container.

Returns:

setResourceMethod

public void setResourceMethod(Method resourceMethod)

getResourceClass

public Class getResourceClass()
Resource class. FYI, this method may return null, specifically within the context of an async HTTP request as contextual information is not available to the container

Returns:

setResourceClass

public void setResourceClass(Class resourceClass)

getMessageBodyWriterInterceptors

public MessageBodyWriterInterceptor[] getMessageBodyWriterInterceptors()

setMessageBodyWriterInterceptors

public void setMessageBodyWriterInterceptors(MessageBodyWriterInterceptor[] messageBodyWriterInterceptors)

getPostProcessInterceptors

public PostProcessInterceptor[] getPostProcessInterceptors()

setPostProcessInterceptors

public void setPostProcessInterceptors(PostProcessInterceptor[] postProcessInterceptors)

getEntity

public 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

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<String,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

setEntity

public void setEntity(Object entity)

setStatus

public void setStatus(int status)

setMetadata

public void setMetadata(MultivaluedMap<String,Object> metadata)

getAnnotations

public Annotation[] getAnnotations()

setAnnotations

public void setAnnotations(Annotation[] annotations)

getGenericType

public Type getGenericType()

setGenericType

public void setGenericType(Type genericType)

writeTo

public void writeTo(HttpRequest request,
                    HttpResponse response,
                    ResteasyProviderFactory providerFactory)
             throws WriterException
If there is an entity, headers are not converted to a string and set on the HttpResponse until the output stream is written to. If there is an exception thrown then the headers are never written to the response. We do this so that on error conditions there is a clean response.

Parameters:
request -
response -
providerFactory -
Throws:
WriterException

resolveContentType

public MediaType resolveContentType()

commitHeaders

public void commitHeaders(HttpResponse response)


Copyright © 2011. All Rights Reserved.