net.sf.basedb.clients.web.util
Class ServletExportOutputStream
java.lang.Object
java.io.OutputStream
net.sf.basedb.core.plugin.ExportOutputStream
net.sf.basedb.clients.web.util.ServletExportOutputStream
- All Implemented Interfaces:
- Closeable, Flushable
public class ServletExportOutputStream
- extends ExportOutputStream
An extension to the ExportOutputStream
class which
directs the output to the response stream of a
HttpServletResponse
object. This allows an export plugin
to send data directly to the web browser without going throgh
the BASE filesystem or temporary files on the disk.
- Version:
- 2.2
- Author:
- nicklas
- Last modified
- $Date: 2008-09-05 17:15:54 +0200 (Fri, 05 Sep 2008) $
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
response
private final HttpServletResponse response
ServletExportOutputStream
public ServletExportOutputStream(HttpServletResponse response)
throws IOException
- Create a new servlet export stream.
- Parameters:
response
- The servlet response object
- Throws:
IOException
- If getting the output stream from the reponse fails.
setContentLength
public void setContentLength(long contentLength)
- Calls
ServletResponse.setContentLength(int)
- Overrides:
setContentLength
in class ExportOutputStream
setMimeType
public void setMimeType(String mimeType)
- Calls
ServletResponse.setContentType(String)
- Overrides:
setMimeType
in class ExportOutputStream
setFilename
public void setFilename(String filename)
- Calls
HttpServletResponse.setHeader(java.lang.String, java.lang.String)
with the following values:
response.setHeader("Content-Disposition", "attachment;filename=<filename>");
If the filename contains unsafe characters it is URL encoded.
- Overrides:
setFilename
in class ExportOutputStream