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

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

public class BinaryResponse
extends Object
implements RestResponse

Simple wrapper to to write binary data response to different content types. e.g. new BinaryResponse(new ByteArrayInputStream(imageBytes), "image/jpeg"); or return new BinaryResponse(new ByteArrayInputStream(imageBytes), "image/png");


Constructor Summary
BinaryResponse(InputStream stream, String contentType)
           
BinaryResponse(InputStream stream, String contentType, int statusCode)
           
 
Method Summary
 void execute(OutputStream outputStream)
           
 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

BinaryResponse

public BinaryResponse(InputStream stream,
                      String contentType)

BinaryResponse

public BinaryResponse(InputStream stream,
                      String contentType,
                      int statusCode)
Method Detail

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.