org.apache.cocoon.rest.controller.response
Class GenericContentTypeResponse

java.lang.Object
  extended by org.apache.cocoon.rest.controller.response.GenericContentTypeResponse
All Implemented Interfaces:
RestResponse

public class GenericContentTypeResponse
extends Object
implements RestResponse

Controller response that can response as any content type.


Constructor Summary
GenericContentTypeResponse(String data, String contentType)
           
GenericContentTypeResponse(String data, String contentType, int statusCode)
           
 
Method Summary
 void execute(OutputStream outputStream)
           
 int getStatusCode()
           
 void setStatusCode(int statusCode)
          You can set the status code as well after creating and instance.
 RestResponseMetaData setup(Map<String,Object> inputParameters)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GenericContentTypeResponse

public GenericContentTypeResponse(String data,
                                  String contentType)
Parameters:
data - the data to return to the client. e.g. dataJson.toString()
contentType - the contentType you want to return. e.g. "application/json"

GenericContentTypeResponse

public GenericContentTypeResponse(String data,
                                  String contentType,
                                  int statusCode)
Parameters:
data - the data to return to the client. e.g. dataJson.toString()
contentType - the contentType you want to return. e.g. "application/json"
statusCode - if you want return any other response code see HttpURLConnection for the different available codes.
Method Detail

getStatusCode

public int getStatusCode()
Returns:
response code see HttpURLConnection for the different available codes that we will return to the client

setStatusCode

public void setStatusCode(int statusCode)
You can set the status code as well after creating and instance.

Parameters:
statusCode - if you want return any other response code see HttpURLConnection for the different available codes.

execute

public void execute(OutputStream outputStream)
             throws Exception
Specified by:
execute in interface RestResponse
Throws:
Exception

setup

public RestResponseMetaData setup(Map<String,Object> inputParameters)
                           throws Exception
Specified by:
setup in interface RestResponse
Throws:
Exception


Copyright © 2008-2012 The Apache Software Foundation. All Rights Reserved.