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 theExportOutputStream
class which directs the output to the response stream of aHttpServletResponse
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
All Methods Instance Methods Concrete Methods 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 Detail
-
response
private final HttpServletResponse response
-
-
Constructor Detail
-
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.
-
-
Method Detail
-
setContentLength
public void setContentLength(long contentLength)
- Overrides:
setContentLength
in classExportOutputStream
-
setMimeType
public void setMimeType(String mimeType)
- Overrides:
setMimeType
in classExportOutputStream
-
setCharacterSet
public void setCharacterSet(String charset)
- Overrides:
setCharacterSet
in classExportOutputStream
- Since:
- 2.9
-
setFilename
public 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.- Overrides:
setFilename
in classExportOutputStream
-
-