org.loom.resolution
Class InputStreamResolution

java.lang.Object
  extended by org.loom.resolution.AbstractHttpResolution
      extended by org.loom.resolution.AbstractFileResolution
          extended by org.loom.resolution.InputStreamResolution
All Implemented Interfaces:
CacheableResolution, HttpResolution, Resolution

public class InputStreamResolution
extends AbstractFileResolution

Deliver the contents from an InputStream to the browser. The stream will be closed when finished.


Constructor Summary
InputStreamResolution(java.io.File file)
          Create a File-based InputStreamResolution.
InputStreamResolution(java.io.InputStream stream)
          Create a InputStreamResolution based on an InputStream Note that this construtor will not hint the browser about the saved file name.
InputStreamResolution(java.lang.String filename, java.io.File file)
          Create a File-based InputStreamResolution
InputStreamResolution(java.lang.String filename, java.io.InputStream stream)
          Create a InputStreamResolution based on an InputStream Note that this construtor will not hint the browser about the saved file name.
InputStreamResolution(java.lang.String filename, java.io.InputStream stream, java.lang.Long fileSize)
          Create a InputStreamResolution based on an InputStream Note that this construtor will not hint the browser about the saved file name.
 
Method Summary
 void resolve(LoomServletRequest request, LoomServletResponse response)
          Write the response contents
 
Methods inherited from class org.loom.resolution.AbstractFileResolution
addCookie, addCookie, addCookie, addHeader, calculateContentDispositionHeader, getFilename, getFileSize, isForceSave, isGuessMimeType, setCacheControl, setCharset, setContentType, setFilename, setFileSize, setForceSave, setGuessMimeType, setHeader, setHeaderIfNotPresent, writeHeaders
 
Methods inherited from class org.loom.resolution.AbstractHttpResolution
addDateHeader, addIntHeader, containsHeader, getCacheControl, getCharset, getContentType, setDateHeader, setDateHeaderIfNotPresent, setIntHeader, setIntHeaderIfNotPresent, setJsonHeader
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InputStreamResolution

public InputStreamResolution(java.io.File file)
                      throws java.io.FileNotFoundException
Create a File-based InputStreamResolution.

Parameters:
file - the file to be delivered to the browser
Throws:
java.io.FileNotFoundException - if the file could not be found

InputStreamResolution

public InputStreamResolution(java.lang.String filename,
                             java.io.File file)
                      throws java.io.FileNotFoundException
Create a File-based InputStreamResolution

Parameters:
filename - the file name that will be used by the browser in the "Save-as" dialog
file - the file to be delivered to the browser
Throws:
java.io.FileNotFoundException - if the file could not be found

InputStreamResolution

public InputStreamResolution(java.io.InputStream stream)
Create a InputStreamResolution based on an InputStream Note that this construtor will not hint the browser about the saved file name.

Parameters:
stream - the inputStream to read contents from

InputStreamResolution

public InputStreamResolution(java.lang.String filename,
                             java.io.InputStream stream)
Create a InputStreamResolution based on an InputStream Note that this construtor will not hint the browser about the saved file name.

Parameters:
stream - the inputStream to read contents from
filename - the file name that will be used by the browser in the "Save-as" dialog (may be null)

InputStreamResolution

public InputStreamResolution(java.lang.String filename,
                             java.io.InputStream stream,
                             java.lang.Long fileSize)
Create a InputStreamResolution based on an InputStream Note that this construtor will not hint the browser about the saved file name.

Parameters:
stream - the inputStream to read contents from
filename - the file name that will be used by the browser in the "Save-as" dialog (may be null)
fileSize - the file size (null if unknown)
Method Detail

resolve

public void resolve(LoomServletRequest request,
                    LoomServletResponse response)
             throws java.io.IOException,
                    javax.servlet.ServletException
Description copied from interface: Resolution
Write the response contents

Specified by:
resolve in interface Resolution
Specified by:
resolve in class AbstractFileResolution
Parameters:
request - the current request object
response - the current response object
Throws:
java.io.IOException
javax.servlet.ServletException