|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.vaadin.server.DownloadStream
public class DownloadStream
Downloadable stream.
Note that the methods in a DownloadStream are called without locking the session to prevent locking the session during long file downloads. If your DownloadStream uses anything from the session, you must handle the locking.
Field Summary | |
---|---|
static long |
DEFAULT_CACHETIME
Default cache time. |
static long |
MAX_CACHETIME
Maximum cache time. |
Constructor Summary | |
---|---|
DownloadStream(java.io.InputStream stream,
java.lang.String contentType,
java.lang.String fileName)
Creates a new instance of DownloadStream. |
Method Summary | |
---|---|
int |
getBufferSize()
Gets the size of the download buffer. |
long |
getCacheTime()
Gets length of cache expiration time. |
java.lang.String |
getContentType()
Gets stream content type. |
java.lang.String |
getFileName()
Returns the file name. |
java.lang.String |
getParameter(java.lang.String name)
Gets a paramater for download stream. |
java.util.Iterator<java.lang.String> |
getParameterNames()
Gets the names of the parameters. |
java.io.InputStream |
getStream()
Gets downloadable stream. |
void |
setBufferSize(int bufferSize)
Sets the size of the download buffer. |
void |
setCacheTime(long cacheTime)
Sets length of cache expiration time. |
void |
setContentType(java.lang.String contentType)
Sets stream content type. |
void |
setFileName(java.lang.String fileName)
Sets the file name. |
void |
setParameter(java.lang.String name,
java.lang.String value)
Sets a paramater for download stream. |
void |
setStream(java.io.InputStream stream)
Sets the stream. |
void |
writeResponse(VaadinRequest request,
VaadinResponse response)
Writes this download stream to a Vaadin response. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final long MAX_CACHETIME
public static final long DEFAULT_CACHETIME
Constructor Detail |
---|
public DownloadStream(java.io.InputStream stream, java.lang.String contentType, java.lang.String fileName)
Method Detail |
---|
public java.io.InputStream getStream()
public void setStream(java.io.InputStream stream)
stream
- The stream to setpublic java.lang.String getContentType()
public void setContentType(java.lang.String contentType)
contentType
- the contentType to setpublic java.lang.String getFileName()
public void setFileName(java.lang.String fileName)
fileName
- the file name to set.public void setParameter(java.lang.String name, java.lang.String value)
name
- the Name of the parameter to set.value
- the Value of the parameter to set.public java.lang.String getParameter(java.lang.String name)
name
- the Name of the parameter to set.
public java.util.Iterator<java.lang.String> getParameterNames()
public long getCacheTime()
DEFAULT_CACHETIME
.
public void setCacheTime(long cacheTime)
cacheTime
- the cache time in milliseconds.public int getBufferSize()
public void setBufferSize(int bufferSize)
bufferSize
- the size of the buffer in bytes.public void writeResponse(VaadinRequest request, VaadinResponse response) throws java.io.IOException
getContentType()
, getCacheTime()
,
getFileName()
) and transferring the data from the stream (
getStream()
) to the response. Defined parameters (
getParameterNames()
) are also included as headers in the
response. If there's is a parameter named Location
, a
redirect (302 Moved temporarily) is sent instead of the contents of this
stream.
request
- the request for which the response should be writtenresponse
- the Vaadin response to write this download stream to
java.io.IOException
- passed through from the Vaadin response
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |