jbpm-form-modeler-request-dispatcher 6.0.0-SNAPSHOT

org.jbpm.formModeler.service.bb.mvc.controller.responses
Class SendStreamResponse

java.lang.Object
  extended by org.jbpm.formModeler.service.bb.mvc.controller.responses.SendStreamResponse
All Implemented Interfaces:
CommandResponse

public class SendStreamResponse
extends Object
implements CommandResponse

This class allows sending a file as response.


Field Summary
protected  String contentDisposition
           
protected  int contentLength
           
protected  String contentType
           
protected  int errorCode
           
protected  InputStream is
           
protected  boolean resetHeaders
           
 
Constructor Summary
SendStreamResponse(File f)
          Send a file as response.
SendStreamResponse(File f, boolean resetHeaders)
          Send a file as response.
SendStreamResponse(InputStream is, String contentDisposition)
          Send a stream as response, resetting response header
SendStreamResponse(InputStream is, String contentDisposition, boolean resetHeaders)
          Send a stream as response.
SendStreamResponse(InputStream is, String contentDisposition, int contentLength)
          Send a stream as response, resetting response header
 
Method Summary
 boolean execute(CommandRequest cmdReq)
          Executes the response.
 String getContentType()
           
protected  void init(InputStream is, String contentDisposition)
           
 void setContentType(String contentType)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

is

protected InputStream is

contentDisposition

protected String contentDisposition

errorCode

protected int errorCode

resetHeaders

protected boolean resetHeaders

contentType

protected String contentType

contentLength

protected int contentLength
Constructor Detail

SendStreamResponse

public SendStreamResponse(InputStream is,
                          String contentDisposition)
Send a stream as response, resetting response header

Parameters:
is - Stream to send
contentDisposition - Should be something like "inline; filename=file.xxx;"

SendStreamResponse

public SendStreamResponse(InputStream is,
                          String contentDisposition,
                          int contentLength)
Send a stream as response, resetting response header

Parameters:
is - Stream to send
contentDisposition - Should be something like "inline; filename=file.xxx;"
contentLength - Lenght of the stream's content

SendStreamResponse

public SendStreamResponse(File f)
Send a file as response.

Parameters:
f - File to send

SendStreamResponse

public SendStreamResponse(InputStream is,
                          String contentDisposition,
                          boolean resetHeaders)
Send a stream as response. Normally, you need to setContentType() before returning this response. The content type can be inferred in any way you want, but it is recommended to use

URLConnection.getFileNameMap().getContentTypeFor( );

Parameters:
is - Stream to send
contentDisposition - Should be something like "inline; filename=file.xxx;"
resetHeaders - Indicates if headers have to be resetted. Default is false, but should be true if the response is JSP or something else that you don't want to be cached.

SendStreamResponse

public SendStreamResponse(File f,
                          boolean resetHeaders)
Send a file as response.

Parameters:
f - File to send
resetHeaders - Indicates if headers have to be resetted. Default is false, but should be true if the response is JSP or something else that you don't want to be cached.
Method Detail

init

protected void init(InputStream is,
                    String contentDisposition)

getContentType

public String getContentType()

setContentType

public void setContentType(String contentType)

execute

public boolean execute(CommandRequest cmdReq)
                throws Exception
Description copied from interface: CommandResponse
Executes the response. It typically will be one of the response types that are provided in the org.jbpm.formModeler.service.mvc.controller.responses package.

Specified by:
execute in interface CommandResponse
Parameters:
cmdReq - Object encapsulating the request information.
Returns:
boolean if the execution has been successfully executed, false otherwise.
Throws:
Exception

jbpm-form-modeler-request-dispatcher 6.0.0-SNAPSHOT

Copyright © 2001-2013 JBoss by Red Hat. All Rights Reserved.