Package | com.yworks.remote |
Class | public class UploadHandler |
Inheritance | UploadHandler AbstractFileReadHandler flash.events.EventDispatcher |
This implementation delegates the work to a flash.net.FileReference
.
The server will recieve a multipart/form-data encoded request of the form:
Content-Type: multipart/form-data; boundary=AaB03x --AaB03x Content-Disposition: form-data; name="graph"; filename="example.graphml" Content-Type: application/octet-stream ... contents of example.graphml ... --AaB03x--To handle this request, the yFiles FLEX server API offers convenicene classes
com.yworks.yfiles.server.graphml.servlets.UploadServlet
yWorks.yFiles.Graph.Web.UploadHandler
For a serverless read handler, see class LoadHandler
.
See also
Property | Defined By | ||
---|---|---|---|
additionalParameters : Object
Get or set an object containing additional parameters that will be
transfered to the service URL. | UploadHandler | ||
fileFilter : Array
An array of flash.net.FileFilter to use with the file browser. | AbstractFileReadHandler | ||
filename : String [read-only]
The filename of the last selected file. | AbstractFileReadHandler | ||
inputIOHandler : GraphMLIOHandler
The GraphMLIOHandler instance that will be used for graph deserialization. | AbstractFileReadHandler | ||
roundtripHandler : RoundtripHandler
The RoundtripHandler instance that will be used for the server roundtrip. | AbstractFileReadHandler |
Method | Defined By | ||
---|---|---|---|
UploadHandler(uploadURL:String, roundtripHandler:RoundtripHandler = null)
Create a new instance for the given service URL. | UploadHandler | ||
Calls the upload URL that was passed upon initialization. | UploadHandler |
Method | Defined By | ||
---|---|---|---|
Create the GraphMLIOHandler instance that will be used for graph deserialization. | AbstractFileReadHandler | ||
createURLRequest(uploadURL:String):URLRequest
Create the URLRequest instance that will be used for the upload request. | UploadHandler | ||
createURLVariables():URLVariables
Create the parameters object that is transferred to the server. | UploadHandler | ||
dispatchXMLResult(result:XML):void
Dispatches a XMLResultEvent containing the received XML data. | AbstractFileReadHandler | ||
handleResult(result:XML):void
Updates the graph with the new GraphML
Has to be called after the upload is complete and the response is received. | AbstractFileReadHandler | ||
onCancel(event:Event):void
Called when the user chose the cancel button of the upload dialog. | AbstractFileReadHandler | ||
onComplete(event:Event):void
Called when the data is sent or loaded. | AbstractFileReadHandler | ||
onHTTPStatus(evt:HTTPStatusEvent):void
Called when the server sends a HTTP status. | AbstractFileReadHandler | ||
onIOError(evt:IOErrorEvent):void
Called when an IO error occurs while executing the file download. | AbstractFileReadHandler | ||
onSecurityError(evt:SecurityErrorEvent):void
Called when a security error occurs while executing the file download. | AbstractFileReadHandler | ||
onSelected(event:Event):void [override]
Called when a file is chosen for upload from the FileChooser. | UploadHandler | ||
onUploadComplete(event:DataEvent):void [override]
Called after the upload is complete and the response is recieved. | UploadHandler | ||
openDialog(graph:IGraph = null, defaultFileName:String = null):void
Opens the file dialog. | AbstractFileReadHandler |
Event | Summary | Defined By | ||
---|---|---|---|---|
Dispatched when the upload method was called and a valid result is received. | UploadHandler |
additionalParameters | property |
additionalParameters:Object
Get or set an object containing additional parameters that will be transfered to the service URL.
public function get additionalParameters():Object
public function set additionalParameters(value:Object):void
UploadHandler | () | Constructor |
public function UploadHandler(uploadURL:String, roundtripHandler:RoundtripHandler = null)
Create a new instance for the given service URL.
ParametersuploadURL:String — An URL that corresponds to a service which recieves a file from the client.
| |
roundtripHandler:RoundtripHandler (default = null ) — The roundtrip handler to receive the inputIOHandler from.
|
createURLRequest | () | method |
protected function createURLRequest(uploadURL:String):URLRequest
Create the URLRequest instance that will be used for the upload request.
Parameters
uploadURL:String — The service URL that was passed upon initialization.
|
URLRequest — An URLRequest instance that will be used in the upload method.
|
createURLVariables | () | method |
protected function createURLVariables():URLVariables
Create the parameters object that is transferred to the server.
ReturnsURLVariables |
onSelected | () | method |
override protected function onSelected(event:Event):void
Called when a file is chosen for upload from the FileChooser.
Creates the URLRequest
and start the upload process.
Parameters
event:Event |
onUploadComplete | () | method |
override protected function onUploadComplete(event:DataEvent):void
Called after the upload is complete and the response is recieved.
If a graph
parameter was passed to the upload()
method,
the result will be written to that graph using the inputIOHandler
.
Otherwise, the roundtripHandler
will be used.
This method will call dispatchXMLResult
to dispatch
a XMLResultEvent
containing the received XML data.
Parameters
event:DataEvent — A DataEvent which holds the GraphML data in its
text property.
|
upload | () | method |
public function upload(graph:IGraph = null, defaultFileName:String = null):void
Calls the upload URL that was passed upon initialization.
Event handling can be customized by overriding the various protected event handler functions.
Parameters
graph:IGraph (default = null ) — The graph instance in which the file contents will be stored. If no graph is passed,
the roundtripHandler will be used to store the graph to. Note, that in this
case, the roundtripHandler has to be properly initialized.
| |
defaultFileName:String (default = null ) — The default file name to be shown in the browser's download dialog.
|
See also
complete | Event |
com.yworks.remote.XMLResultEvent
com.yworks.remote.XMLResultEvent.COMPLETE
Dispatched when the upload
method was called and a valid result is received.
The event is dispatched before doUpdate
is called.
XML
was received from the server.
The received XML
is stored in the xmlResult
property.