Package muntjac :: Package terminal :: Module file_resource :: Class FileResource
[hide private]
[frames] | no frames]

Class FileResource

source code

                           object --+        
                                    |        
                   resource.IResource --+    
                                        |    
application_resource.IApplicationResource --+
                                            |
                                           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.


Authors:
Vaadin Ltd., Richard Lincoln

Version: 1.1.2

Instance Methods [hide private]
 
__init__(self, sourceFile, application)
Creates a new file resource for providing given file for client terminals.
source code
 
getStream(self)
Gets the resource as stream.
source code
 
getSourceFile(self)
Gets the source file.
source code
 
setSourceFile(self, sourceFile)
Sets the source file.
source code
 
getApplication(self)
Gets the application of the resource.
source code
 
getFilename(self)
Gets the virtual filename for this resource.
source code
 
getMIMEType(self)
Gets the MIME type of the resource.
source code
 
getCacheTime(self)
Gets the length of cache expiration time.
source code
 
setCacheTime(self, cacheTime)
Sets the length of cache expiration time.
source code
 
getBufferSize(self)
Gets the size of the download buffer used for this resource.
source code
 
setBufferSize(self, bufferSize)
Sets the size of the download buffer used for this resource.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]

Inherited from application_resource.IApplicationResource: DEFAULT_CACHETIME

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, sourceFile, application)
(Constructor)

source code 

Creates a new file resource for providing given file for client terminals.

Overrides: object.__init__

getStream(self)

source code 

Gets the resource as stream.

Overrides: application_resource.IApplicationResource.getStream

getSourceFile(self)

source code 

Gets the source file.

Returns:
the source File.

setSourceFile(self, sourceFile)

source code 

Sets the source file.

Parameters:
  • sourceFile - the source file to set.

getApplication(self)

source code 

Gets the application of the resource.

Overrides: application_resource.IApplicationResource.getApplication

getFilename(self)

source code 

Gets the virtual filename for this resource.

Returns:
the file name associated to this resource.
Overrides: application_resource.IApplicationResource.getFilename

getMIMEType(self)

source code 

Gets the MIME type of the resource.

Returns:
the MIME type of the resource.
Overrides: resource.IResource.getMIMEType

getCacheTime(self)

source code 

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 DownloadStream.DEFAULT_CACHETIME.

Returns:
Cache time in milliseconds.
Overrides: application_resource.IApplicationResource.getCacheTime

setCacheTime(self, cacheTime)

source code 

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.

Parameters:
  • cacheTime - the cache time in milliseconds.

getBufferSize(self)

source code 

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.

Returns:
the size of the buffer in bytes.
Overrides: application_resource.IApplicationResource.getBufferSize
(inherited documentation)

setBufferSize(self, bufferSize)

source code 

Sets the size of the download buffer used for this resource.

Parameters:
  • bufferSize - the size of the buffer in bytes.