|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.vaadin.server.FileResource
public class FileResource
FileResources
are files or directories on local filesystem. The
files and directories are served through URI:s to the client terminal and
thus must be registered to an URI context before they can be used. The
resource is automatically registered to the application when it is created.
Field Summary |
---|
Fields inherited from interface com.vaadin.server.ConnectorResource |
---|
CONNECTOR_PATH |
Constructor Summary | |
---|---|
FileResource(java.io.File sourceFile)
Creates a new file resource for providing given file for client terminals. |
Method Summary | |
---|---|
int |
getBufferSize()
Gets the size of the download buffer used for this resource. |
long |
getCacheTime()
Gets the length of cache expiration time. |
java.lang.String |
getFilename()
Gets the virtual filename for this resource. |
java.lang.String |
getMIMEType()
Gets the MIME type of the resource. |
java.io.File |
getSourceFile()
Gets the source file. |
DownloadStream |
getStream()
Gets resource as stream. |
void |
setBufferSize(int bufferSize)
Sets the size of the download buffer used for this resource. |
void |
setCacheTime(long cacheTime)
Sets the length of cache expiration time. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FileResource(java.io.File sourceFile)
sourceFile
- the file that should be served.Method Detail |
---|
public DownloadStream getStream()
ConnectorResource
Note that this method is called while the session is locked to prevent
race conditions but the methods in the returned DownloadStream
are assumed to be unrelated to the VaadinSession and are called without
holding session locks (to prevent locking the session during long file
downloads).
getStream
in interface ConnectorResource
public java.io.File getSourceFile()
public java.lang.String getFilename()
ConnectorResource
getFilename
in interface ConnectorResource
public java.lang.String getMIMEType()
Resource
getMIMEType
in interface Resource
public long getCacheTime()
DownloadStream.DEFAULT_CACHETIME
.
public void setCacheTime(long cacheTime)
cacheTime
- the cache time in milliseconds.public int getBufferSize()
If the buffer size is 0, the buffer size is decided by the terminal adapter. The default value is 0.
public void setBufferSize(int bufferSize)
bufferSize
- the size of the buffer in bytes.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |