com.vaadin.terminal.
Class ClassResource
java.lang.Object
com.vaadin.terminal.ClassResource
All Implemented Interfaces:
- extends Object
- implements ApplicationResource, Serializable
public class ClassResource
ClassResource
is a named resource accessed with the class
loader.
This can be used to access resources such as icons, files, etc.
Since:
3.0
Version:
6.8.18
Author:
Vaadin Ltd.
See Also:
Field Summary |
---|
Fields inherited from interface com.vaadin.terminal.ApplicationResource |
---|
DEFAULT_CACHETIME |
Constructor Summary | |
---|---|
ClassResource(Class<?> associatedClass,
String resourceName,
Application application)
Creates a new application resource instance. |
|
ClassResource(String resourceName,
Application application)
Creates a new application resource instance. |
Method Summary | |
---|---|
Application |
getApplication()
Gets the application of this resource. |
int |
getBufferSize()
Gets the size of the download buffer used for this resource. |
long |
getCacheTime()
Gets the length of cache expiration time. |
String |
getFilename()
Gets the virtual filename for this resource. |
String |
getMIMEType()
Gets the MIME type of this resource. |
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 |
---|
ClassResource
public ClassResource(String resourceName,
Application application)
- Parameters:
resourceName
- the Unique identifier of the resource within the application.application
- the application this resource will be added to.
Creates a new application resource instance. The resource id is relative to the location of the application class.
ClassResource
public ClassResource(Class<?> associatedClass,
String resourceName,
Application application)
- Parameters:
associatedClass
- the class of the which the resource is associated.resourceName
- the Unique identifier of the resource within the application.application
- the application this resource will be added to.
Creates a new application resource instance.
Method Detail |
---|
getMIMEType
public String getMIMEType()
- Specified by:
getMIMEType
in interfaceResource
- Returns:
- the MIME type of the resource.
- See Also:
Resource.getMIMEType()
Gets the MIME type of this resource.
getApplication
public Application getApplication()
- Specified by:
getApplication
in interfaceApplicationResource
- See Also:
ApplicationResource.getApplication()
Gets the application of this resource.
getFilename
public String getFilename()
- Specified by:
getFilename
in interfaceApplicationResource
- Returns:
- the file name associated to this resource.
- See Also:
ApplicationResource.getFilename()
Gets the virtual filename for this resource.
getStream
public DownloadStream getStream()
- Specified by:
getStream
in interfaceApplicationResource
- See Also:
ApplicationResource.getStream()
Gets resource as stream.
getBufferSize
public int getBufferSize()
- Specified by:
getBufferSize
in interfaceApplicationResource
- Returns:
- int the size of the buffer in bytes.
Description copied from interface: ApplicationResource
Gets the size of the download buffer used for this resource.
If the buffer size is 0, the buffer size is decided by the terminal adapter. The default value is 0.
setBufferSize
public void setBufferSize(int bufferSize)
- Parameters:
bufferSize
- the size of the buffer in bytes.
Sets the size of the download buffer used for this resource.
getCacheTime
public long getCacheTime()
- Specified by:
getCacheTime
in interfaceApplicationResource
- Returns:
- Cache time in milliseconds
Description copied from interface: ApplicationResource
Gets the length of cache expiration time.
This gives the adapter the possibility cache streams sent to the client.
The caching may be made in adapter or at the client if the client
supports caching. Default is DEFAULT_CACHETIME
.
setCacheTime
public void setCacheTime(long cacheTime)
- Parameters:
cacheTime
- the cache time in milliseconds.
Sets the length of cache expiration time.
This gives the adapter the possibility cache streams sent to the client. The caching may be made in adapter or at the client if the client supports caching. Zero or negavive value disbales the caching of this stream.