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

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

public class TextResponse
extends Object
implements RestResponse

Simple wrapper to to write string data response to different content types. e.g. new TextResponse(dataJson.toString(), "application/json") or return new TextResponse(test, "text/plain")


Constructor Summary
TextResponse(String data, String contentType)
           
TextResponse(String data, String contentType, int statusCode)
           
 
Method Summary
 void execute(OutputStream outputStream)
           
 String getCharset()
           
 int getStatusCode()
           
 void setCharset(String charset)
           
 void setStatusCode(int statusCode)
           
 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

TextResponse

public TextResponse(String data,
                    String contentType)

TextResponse

public TextResponse(String data,
                    String contentType,
                    int statusCode)
Method Detail

setup

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

execute

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

getStatusCode

public int getStatusCode()

setStatusCode

public void setStatusCode(int statusCode)

getCharset

public String getCharset()

setCharset

public void setCharset(String charset)


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