Package muntjac :: Package terminal :: Module stream_resource :: Class StreamResource
[hide private]
[frames] | no frames]

Class StreamResource

source code

                           object --+        
                                    |        
                   resource.IResource --+    
                                        |    
application_resource.IApplicationResource --+
                                            |
                                           StreamResource

StreamResource is a resource provided to the client directly by the application. The strean resource is fetched from URI that is most often in the context of the application or window. The resource is automatically registered to window in creation.


Authors:
Vaadin Ltd., Richard Lincoln

Version: 1.1.2

Instance Methods [hide private]
 
__init__(self, streamSource, filename, application)
Creates a new stream resource for downloading from stream.
source code
 
getMIMEType(self)
Gets the MIME type of the resource.
source code
 
setMIMEType(self, MIMEType)
Sets the mime type of the resource.
source code
 
getStreamSource(self)
Returns the source for this StreamResource.
source code
 
setStreamSource(self, streamSource)
Sets the source for this StreamResource.
source code
 
getFilename(self)
Gets the filename.
source code
 
setFilename(self, filename)
Sets the filename.
source code
 
getApplication(self)
Gets the application of the resource.
source code
 
getStream(self)
Gets resource as stream.
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
 
getCacheTime(self)
Gets the length of cache expiration time.
source code
 
setCacheTime(self, cacheTime)
Sets the length of cache expiration time.
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, streamSource, filename, application)
(Constructor)

source code 

Creates a new stream resource for downloading from stream.

Parameters:
  • streamSource - the source Stream.
  • filename - the name of the file.
  • application - the Application object.
Overrides: object.__init__

getMIMEType(self)

source code 

Gets the MIME type of the resource.

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

See Also: IResource.getMIMEType

setMIMEType(self, MIMEType)

source code 

Sets the mime type of the resource.

Parameters:
  • MIMEType - the MIME type to be set.

getStreamSource(self)

source code 

Returns the source for this StreamResource. StreamSource is queried when the resource is about to be streamed to the client.

Returns:
Source of the StreamResource.

setStreamSource(self, streamSource)

source code 

Sets the source for this StreamResource. StreamSource is queried when the resource is about to be streamed to the client.

Parameters:
  • streamSource - the source to set.

getFilename(self)

source code 

Gets the filename.

Returns:
the filename.
Overrides: application_resource.IApplicationResource.getFilename

setFilename(self, filename)

source code 

Sets the filename.

Parameters:
  • filename - the filename to set.

getApplication(self)

source code 

Gets the application of the resource.

Overrides: application_resource.IApplicationResource.getApplication

getStream(self)

source code 

Gets resource as stream.

Overrides: application_resource.IApplicationResource.getStream

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.

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

Returns:
Cache time in milliseconds
Overrides: application_resource.IApplicationResource.getCacheTime
(inherited documentation)

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 negative value disables the caching of this stream.

Parameters:
  • cacheTime - the cache time in milliseconds.