Packagecom.yworks.remote
Classpublic class DownloadHandler
InheritanceDownloadHandler Inheritance AbstractFileWriteHandler Inheritance flash.events.EventDispatcher

Handler for server requests that are expected to respond with a file stream which will be saved locally.

For a serverless write handler, see class SaveHandler

See also

com.yworks.remote.SaveHandler


Public Properties
 PropertyDefined By
  additionalParameters : Object
Get or set an object containing additional parameters that will be transfered to the service URL.
DownloadHandler
  compress : Boolean
Whether to use compression for the graphml data that is sent to the server.
DownloadHandler
 InheritedfileName : String
[read-only] The name of the last successfully downloaded file.
AbstractFileWriteHandler
 InheritedoutputIOHandler : GraphMLIOHandler
Get or set the GraphMLIOHandler instance that will be used for graph serialization.
AbstractFileWriteHandler
  uriEncode : Boolean
Whether to encode the graphML string sent to the server using the global encodeURIComponent function.
DownloadHandler
Protected Properties
 PropertyDefined By
 InheritedfileReference : FileReference
The FileReference which handles the file operations.
AbstractFileWriteHandler
Public Methods
 MethodDefined By
  
DownloadHandler(downloadURL:String, roundtripHandler:RoundtripHandler = null)
Create a new instance for the given service URL.
DownloadHandler
  
download(graph:IGraph, defaultFileName:String):void
Calls the download URL that was passed upon initialization.
DownloadHandler
Protected Methods
 MethodDefined By
 Inherited
createFileReference():FileReference
Creates a new FileReference and sets the fileReference property.
AbstractFileWriteHandler
 Inherited
Create the GraphML representation of the given graph.
AbstractFileWriteHandler
 Inherited
Create the GraphMLIOHandler instance that will be used for graph serialization.
AbstractFileWriteHandler
  
createURLRequest(downloadURL:String):URLRequest
Create the URLRequest instance that will be used for the download request.
DownloadHandler
  
createURLVariables(graph:IGraph):URLVariables
Create the parameters object that is transferred to the server.
DownloadHandler
 Inherited
onCancel(evt:Event):void
Called when the user cancels the download using the file chooser's cancel button.
AbstractFileWriteHandler
 Inherited
onComplete(evt:Event):void
Called when the download operation has finished successfully.
AbstractFileWriteHandler
 Inherited
onHTTPStatus(evt:HTTPStatusEvent):void
Called when the server sends a HTTP status.
AbstractFileWriteHandler
 Inherited
onIOError(evt:IOErrorEvent):void
Called when an IO error occurs while executing the file download.
AbstractFileWriteHandler
 Inherited
onProgress(evt:ProgressEvent):void
Dispatched periodically during the file upload or download operation.
AbstractFileWriteHandler
 Inherited
onSecurityError(evt:SecurityErrorEvent):void
Called when a security error occurs while executing the file download.
AbstractFileWriteHandler
 Inherited
onSelect(evt:Event):void
Called when the user has selected a location for the file download.
AbstractFileWriteHandler
Property Detail
additionalParametersproperty
additionalParameters:Object

Get or set an object containing additional parameters that will be transfered to the service URL.


Implementation
    public function get additionalParameters():Object
    public function set additionalParameters(value:Object):void
compressproperty 
compress:Boolean

Whether to use compression for the graphml data that is sent to the server.

If true, the value of the "graph" parameter will be compressed using zlib compression and encoded using base64 encoding.

The default value is true.


Implementation
    public function get compress():Boolean
    public function set compress(value:Boolean):void
uriEncodeproperty 
uriEncode:Boolean

Whether to encode the graphML string sent to the server using the global encodeURIComponent function.

The default value is false.


Implementation
    public function get uriEncode():Boolean
    public function set uriEncode(value:Boolean):void

See also

Constructor Detail
DownloadHandler()Constructor
public function DownloadHandler(downloadURL:String, roundtripHandler:RoundtripHandler = null)

Create a new instance for the given service URL.

Parameters
downloadURL:String — An URL that corresponds to a service which sends a file to the client.
 
roundtripHandler:RoundtripHandler (default = null) — The roundtrip handler to receive the outputIOHandler from.
Method Detail
createURLRequest()method
protected function createURLRequest(downloadURL:String):URLRequest

Create the URLRequest instance that will be used for the download request.

Parameters

downloadURL:String — The service URL that was passed upon initialization.

Returns
URLRequest — An URLRequest instance that will be used in the download method.
createURLVariables()method 
protected function createURLVariables(graph:IGraph):URLVariables

Create the parameters object that is transferred to the server.

This implementation will include a serialization of the current graph instance contained in the graphCanvas, if send is true. The GraphML string will be sent as a request parameter named "graph".

If compress is true, the GraphML serialization of the graph will be compressed and base64-encoded. This is indicated to the server by prepending "base64/zlib" to the "graphEncoding" request parameter. If uriEncode is true, the GraphML string will be encoded using the global encodeURIComponent function. This is indicated to the server by setting thge "graphEncoding" request parameter to "encodeURIComponent".

Parameters

graph:IGraph — The graph to be serialized

Returns
URLVariables — The parameters object to be transferred to the server.

See also

download()method 
public function download(graph:IGraph, defaultFileName:String):void

Calls the download URL that was passed upon initialization.

Event handling can be customized by overriding the various protected event handler functions.

Parameters

graph:IGraph — The graph instance that is to be serialized.
 
defaultFileName:String — The default file name to be shown in the browser's download dialog.