Package 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
,AutoCloseable
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: 2016-05-23 12:34:34 +0200 (må, 23 maj 2016) $
-
Field Summary
Fields Modifier and Type Field Description private HttpServletResponse
response
-
Constructor Summary
Constructors Constructor Description ServletExportOutputStream(HttpServletResponse response)
Create a new servlet export stream. -
Method Summary
Modifier and Type Method Description void
setCharacterSet(String charset)
void
setContentLength(long contentLength)
void
setFilename(String filename)
CallsHttpServletResponse.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.void
setMimeType(String mimeType)
Methods inherited from class net.sf.basedb.core.plugin.ExportOutputStream
close, flush, getFile, write, write, write
Methods inherited from class java.io.OutputStream
nullOutputStream
-
Field Details
-
response
-
-
Constructor Details
-
ServletExportOutputStream
Create a new servlet export stream.- Parameters:
response
- The servlet response object- Throws:
IOException
- If getting the output stream from the reponse fails.
-
-
Method Details
-
setContentLength
public void setContentLength(long contentLength)- Overrides:
setContentLength
in classExportOutputStream
-
setMimeType
- Overrides:
setMimeType
in classExportOutputStream
-
setCharacterSet
- Overrides:
setCharacterSet
in classExportOutputStream
- Since:
- 2.9
-
setFilename
CallsHttpServletResponse.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 classExportOutputStream
-