org.exoplatform.services.rest
Class Response

java.lang.Object
  extended by org.exoplatform.services.rest.Response

public class Response
extends Object

REST Response.

Version:
$Id: $
Author:
Andrey Parfonov

Nested Class Summary
static class Response.Builder
          REST Response builder.
 
Constructor Summary
protected Response(int status, MultivaluedMetadata responseHeaders, Object entity, List<Cookie> cookies, OutputEntityTransformer transformer, Map<String,String> transformerParameters)
           
 
Method Summary
 List<Cookie> getCookies()
           
 Object getEntity()
          Body of HTTP response.
 EntityMetadata getEntityMetadata()
          EntityMetadata gives possibility to view some response headers by use method get.
For example:
 MultivaluedMetadata getResponseHeaders()
          HTTP headers.
 int getStatus()
          HTTP status of response.
 OutputEntityTransformer getTransformer()
          Get an entity transformer.
 Map<String,String> getTransformerParameters()
          Get parameters for OutputEntityTransformer.
 boolean isEntityInitialized()
          Is entity initialized.
 boolean isTransformerInitialized()
          Is transformer initialized.
 void setTransformer(OutputEntityTransformer transformer)
          Set entity transformer.
 void writeEntity(OutputStream outputEntityStream)
          Write entity to output stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Response

protected Response(int status,
                   MultivaluedMetadata responseHeaders,
                   Object entity,
                   List<Cookie> cookies,
                   OutputEntityTransformer transformer,
                   Map<String,String> transformerParameters)
Parameters:
status - the HTTP status.
responseHeaders - the HTTP headers.
entity - the representation requested object.
cookies - the cookies.
transformer - the entity serializator.
transformerParameters - the additional parameters for transformer.
Method Detail

getStatus

public int getStatus()
HTTP status of response.

Returns:
the HTTP status.

getResponseHeaders

public MultivaluedMetadata getResponseHeaders()
HTTP headers.

Returns:
the HTTP headers for response

getEntity

public Object getEntity()
Body of HTTP response. Entity is a representation of requested resource.

Returns:
the entity

getCookies

public List<Cookie> getCookies()
Returns:
the cookies that will be added to response.

getEntityMetadata

public EntityMetadata getEntityMetadata()
EntityMetadata gives possibility to view some response headers by use method get.
For example:
 metadata.getMediaType()
 
- Content-Type header.

Returns:
the entity meta data.
See Also:
org.exoplatform.services.rest.EntityMetadata.

isTransformerInitialized

public boolean isTransformerInitialized()
Is transformer initialized.

Returns:
the state of OutputEntityTransformer.

isEntityInitialized

public boolean isEntityInitialized()
Is entity initialized. For HTTP it means has request entity body or not.

Returns:
the entity state.

getTransformerParameters

public Map<String,String> getTransformerParameters()
Get parameters for OutputEntityTransformer. This parameters can be set by ResourceContainer.

Returns:
OutputEntityTransformer parameters;

setTransformer

public void setTransformer(OutputEntityTransformer transformer)
Set entity transformer.

Parameters:
transformer - the transformer which can serialize entity.

writeEntity

public void writeEntity(OutputStream outputEntityStream)
                 throws IOException
Write entity to output stream.

Parameters:
outputEntityStream - the output stream for writing entity.
Throws:
IOException - Input/Output Exception.

getTransformer

public OutputEntityTransformer getTransformer()
Get an entity transformer.

Returns:
transformer the transformer which can serialize entity


Copyright © 2009 eXo Platform SAS. All Rights Reserved.