{"id":28195361,"url":"https://github.com/artema/flexrest","last_synced_at":"2025-05-16T14:13:11.195Z","repository":{"id":145539583,"uuid":"3681222","full_name":"artema/FlexRest","owner":"artema","description":"An attempt to make integration with REST services in Flex less painful. Based on the Flex's SerializationFilter architecture, it can be plugged into your project seamlessly without replacing existing data access objects.","archived":false,"fork":false,"pushed_at":"2014-04-01T22:51:39.000Z","size":1533,"stargazers_count":6,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2023-03-22T22:36:16.420Z","etag":null,"topics":["actionscript","actionscript3","flash","flex","rest","rest-api","rest-client"],"latest_commit_sha":null,"homepage":"","language":"ActionScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/artema.png","metadata":{"files":{"readme":"README.textile","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-03-10T18:05:22.000Z","updated_at":"2023-03-22T22:46:10.960Z","dependencies_parsed_at":"2023-03-22T22:46:10.656Z","dependency_job_id":null,"html_url":"https://github.com/artema/FlexRest","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artema%2FFlexRest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artema%2FFlexRest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artema%2FFlexRest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artema%2FFlexRest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/artema","download_url":"https://codeload.github.com/artema/FlexRest/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254544154,"owners_count":22088808,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["actionscript","actionscript3","flash","flex","rest","rest-api","rest-client"],"created_at":"2025-05-16T14:13:07.838Z","updated_at":"2025-05-16T14:13:11.178Z","avatar_url":"https://github.com/artema.png","language":"ActionScript","readme":"There are several custom SerializationFilters that can make your life easier (requires Flex 4).\r\n\r\nh1. CompositeSerializationFilter\r\n\r\nComposite design pattern implementation for HTTP serialization filters. Override any of 5 SerializationFilter's methods using different filter instances:\r\n\r\nbc. \u003cmx:HTTPService\u003e\r\n\t\u003cmx:serializationFilter\u003e\r\n\t\t\u003crest:CompositeSerializationFilter\u003e\r\n\t\t\t\u003c!-- Serialize requests in JSON --\u003e\r\n\t\t\t\u003crest:bodySerializer\u003e\r\n\t\t\t\t\u003crest:JSONSerializationFilter /\u003e\r\n\t\t\t\u003c/rest:bodySerializer\u003e\r\n\t\t\t\u003c!-- Deserialize replies in JSON --\u003e\r\n\t\t\t\u003crest:resultDeserializer\u003e\r\n\t\t\t\t\u003crest:JSONSerializationFilter /\u003e\r\n\t\t\t\u003c/rest:resultDeserializer\u003e\r\n\t\t\t\u003c!-- Build REST-style URLs dynamically --\u003e\r\n\t\t\t\u003crest:urlSerializer\u003e\r\n\t\t\t\t\u003crest:RESTSerializationFilter /\u003e\r\n\t\t\t\u003c/rest:urlSerializer\u003e\r\n\t\t\t\u003c!-- Use custom HTTP methods --\u003e\r\n\t\t\t\u003crest:parametersSerializer\u003e\r\n\t\t\t\t\u003crest:RESTSerializationFilter /\u003e\r\n\t\t\t\u003c/rest:parametersSerializer\u003e\r\n\t\t\t\u003c!-- Set request content type to application/json --\u003e\r\n\t\t\t\u003crest:contentTypeProvider\u003e\r\n\t\t\t\t\u003crest:RESTSerializationFilter requestContentType=\"application/json\" /\u003e\r\n\t\t\t\u003c/rest:contentTypeProvider\u003e\r\n\t\t\u003c/rest:CompositeSerializationFilter\u003e\r\n\t\u003c/mx:serializationFilter\u003e\r\n\u003c/mx:HTTPMultiService\u003e\r\n\r\n\r\nSerializationFilter's methods that can be overriden:\r\n* @deserializeResult@\r\n* @getRequestContentType@\r\n* @serializeParameters@\r\n* @serializeBody@\r\n* @serializeURL@\r\n\r\nMethods that are not overridden are handled using a regular SerializationFilter.\r\n\r\nh1. RESTSerializationFilter\r\n\r\nImplements @serializeParameters@, @contentTypeProvider@ and @serializeURL@ methods.\r\n\r\nAllows you to sent custom HTTP verbs, other than GET or POST, which is not supported by the Flash Player by default. You can specify one of the three possible ways to do that:\r\n* Send it in a X-HTTP-Method-Override header (@methodOverride=\"header\"@). Don't forget to \"update your crossdomain.xml\":http://helpx.adobe.com/flash-player/kb/arbitrary-headers-sent-flash-player.html file to allow headers to be sent to other domains.\r\n* Append a @_method@ parameter to all URLs (@methodOverride=\"url\"@).\r\n* Send it a request body as a @_method@ parameter (@methodOverride=\"variable\"@). This will force your request to be serialized as @application/x-www-form-urlencoded@.\r\n\r\nThis serialization filter can also be used to build dynamic URLs that containt tokenized parameters (enclosed in square brackets).\r\n\r\nbc. \u003cfx:Declarations\u003e\r\n\t\u003crest:RESTSerializationFilter \r\n\t\tid=\"restSerializer\" \r\n\t\tmethodOverride=\"variable\"\r\n\t\trequestContentType=\"application/x-www-form-urlencoded\" /\u003e\r\n\t\u003cmx:HTTPMultiService\r\n\t\tid=\"service\"\r\n\t\tbaseURL=\"http://example.com/api/\"\t\r\n\t\u003e\r\n\t\t\u003cmx:serializationFilter\u003e\r\n\t\t\t\u003c!-- contentTypeProvider is required in order to convert custom HTTP verbs to POST \r\n\t\t\tand to set content type to 'application/x-www-form-urlencoded'. --\u003e\r\n\t\t\t\u003c!-- urlSerializer will replace square bracket tokens in URLs. --\u003e\r\n\t\t\t\u003c!-- parametersSerializer will add a '_method' variable to your requests, if needed. --\u003e\r\n\t\t\t\u003crest:CompositeSerializationFilter \r\n\t\t\t\tcontentTypeProvider=\"{restSerializer}\" \r\n\t\t\t\turlSerializer=\"{restSerializer}\"\r\n\t\t\t\tparametersSerializer=\"{restSerializer}\" /\u003e\r\n\t\t\u003c/mx:serializationFilter\u003e\t\t\r\n\t\t\u003cmx:operationList\u003e\r\n\t\t\t\u003c!-- \r\n\t\t\t\t[ID] and any other token will be automatically \r\n\t\t\t\treplaced by variables from operation arguments object \r\n\t\t\t--\u003e\r\n\t\t\t\u003cmx:HTTPOperation\r\n\t\t\t\tname=\"getUser\"\r\n\t\t\t\turl=\"User/[ID]\" /\u003e\t\t\t\r\n\t\t\t\u003c!--\r\n\t\t\t\tRequest will be sent as a POST request\r\n\t\t\t\twith a \"_method\"=\"DELETE\" variable\r\n\t\t\t--\u003e\r\n\t\t\t\u003cmx:HTTPOperation\r\n\t\t\t\tname=\"deleteUser\"\r\n\t\t\t\turl=\"User/[ID]\"\r\n\t\t\t\tmethod=\"DELETE\" /\u003e\r\n\t\t\u003c/mx:operationList\u003e\r\n\t\u003c/mx:HTTPMultiService\u003e\r\n\u003c/fx:Declarations\u003e\r\n\r\n\u003cpre\u003e\u003ccode\u003eimport mx.rpc.AbstractOperation;\r\nimport mx.rpc.AsyncToken;\r\n\t\t\r\nimport vo.User;\r\n\t\t\r\nprivate function getUser(userId:uint):AsyncToken\r\n{\r\n\tvar operation:AbstractOperation = service.getOperation(\"getUser\");\r\n\toperation.arguments = { ID: userId }; //replace URL tokens\r\n\t\t\t\r\n\treturn operation.send();\r\n\t//You can also add your variable to requests:\r\n\t//return operation.send({ varname: \"varvalue\" });\r\n}\u003c/code\u003e\u003c/pre\u003e\r\n\r\nh1. JSONSerializationFilter\r\n\r\nImplements @deserializeResult@, @contentTypeProvider@ and @serializeBody@ methods.\r\n\r\nSerialize requests and deserialize replies in JSON with a fast native JSON parser (only in FP11 version; FP9 version is relying on as3corelib's JSON parser). Requests and replies can be converted from and into strongly-typed objects on the fly. The following object mapping features are available:\r\n* Incoming arrays can be mapped to strongly-typed vectors or arrays of typed objects.\r\n* @ArrayElementType@ metatag can be used to map arrays of typed objects.\r\n* @Transient@ metatag is respected both in requests and responses.\r\n* Date strings in JSON format @/Date(1325376000000)/@ can be converted to @Date@ objects, and vice versa.\r\n\r\nFor example, when you receive this:\r\n\u003cpre\u003e\u003ccode\u003e{\r\n\t\"owner\":{\r\n\t\t\"birthday\":\"/Date(1325376000000)/\",\r\n\t\t\"firstName\":\"John\",\r\n\t\t\"lastName\":\"Smith\"\r\n\t}\r\n\t\"wheels\":[\r\n\t\t{ \"position\": { \"x\":1, \"y\":1 } },\r\n\t\t{ \"position\": { \"x\":1, \"y\":-1 } },\r\n\t\t{ \"position\": { \"x\":-1, \"y\":1 } },\r\n\t\t{ \"position\": { \"x\":-1, \"y\":-1 } }\r\n\t]\r\n}\r\n\u003c/code\u003e\u003c/pre\u003e\r\nIt can be converted into these:\r\n\u003cpre\u003e\u003ccode\u003epublic class User\r\n{\r\n\tpublic var birthday:Date;\t\t\r\n\tpublic var firstName:String;\t\t\r\n\tpublic var lastName:String;\r\n}\t\r\npublic class Car\r\n{\r\n\tpublic var owner:User;\r\n\t[ArrayElementType(\"vo.Wheel\")] \r\n\tpublic var wheels:Array;\t\r\n\t//You can just use vectors instead\r\n\t//public var wheels:Vector.\u003cWheel\u003e\r\n}\r\nimport flash.geom.Point;\r\npublic class Wheel\r\n{\r\n\tpublic var position:Point;\r\n}\u003c/code\u003e\u003c/pre\u003e\r\nUsing the following code:\r\n\r\nbc. \u003cfx:Declarations\u003e\r\n\t\u003cmx:HTTPMultiService\r\n\t\tid=\"service\"\r\n\t\tbaseURL=\"http://example.com/api/\"\t\r\n\t\u003e\r\n\t\t\u003cmx:serializationFilter\u003e\r\n\t\t\t\u003crest:CompositeSerializationFilter\u003e\r\n\t\t\t\t\u003c!-- Serialize requests from objects to JSON. --\u003e\r\n\t\t\t\t\u003crest:bodySerializer\u003e\r\n\t\t\t\t\t\u003crest:JSONSerializationFilter /\u003e\r\n\t\t\t\t\u003c/rest:bodySerializer\u003e\r\n\t\t\t\t\u003c!-- Deserialize replies from JSON to strongly-typed objects. --\u003e\r\n\t\t\t\t\u003crest:resultDeserializer\u003e\r\n\t\t\t\t\t\u003crest:JSONSerializationFilter /\u003e\r\n\t\t\t\t\u003c/rest:resultDeserializer\u003e\r\n\t\t\t\t\u003c!-- Forces requests content type to be 'application/json'.\r\n\t\t\t\t     This is required in order to encode requests in JSON.\r\n\t\t\t\t     If content type is not changed either this way, \r\n\t\t\t\t     or manually on an operation, Flex will handle \r\n\t\t\t\t     request body encoding by itself. --\u003e\r\n\t\t\t\t\u003crest:contentTypeProvider\u003e\r\n\t\t\t\t\t\u003crest:RESTSerializationFilter requestContentType=\"application/json\" /\u003e\r\n\t\t\t\t\u003c/rest:contentTypeProvider\u003e\r\n\t\t\t\t\u003c!-- This serializer is required for JSON requests. --\u003e\r\n\t\t\t\t\u003crest:parametersSerializer\u003e\r\n\t\t\t\t\t\u003crest:RESTSerializationFilter /\u003e\r\n\t\t\t\t\u003c/rest:parametersSerializer\u003e\r\n\t\t\t\u003c/rest:CompositeSerializationFilter\u003e\r\n\t\t\u003c/mx:serializationFilter\u003e\t\t\r\n\t\t\u003cmx:operationList\u003e\r\n\t\t\t\u003c!-- \r\n\t\t\t\tNote that there is a resultElementType\r\n\t\t\t\tproperty set on the operation\r\n\t\t\t--\u003e\r\n\t\t\t\u003cmx:HTTPOperation\r\n\t\t\t\tname=\"getCar\"\r\n\t\t\t\turl=\"Car/[ID]\"\r\n\t\t\t\tmethod=\"GET\"\r\n\t\t\t\tresultElementType=\"{Car}\"\r\n\t\t\t\tresult=\"onCarLoaded(event)\" /\u003e\r\n\t\t\u003c/mx:operationList\u003e\r\n\t\u003c/mx:HTTPMultiService\u003e\r\n\u003c/fx:Declarations\u003e\r\n\r\n\u003cpre\u003e\u003ccode\u003eimport mx.rpc.events.ResultEvent;\r\n\t\t\r\nimport vo.Car;\r\nimport vo.User;\r\nimport vo.Wheel;\r\n\t\t\r\nprivate function onCarLoaded(event:ResultEvent):void\r\n{\r\n\tvar car:Car = Car(event.result);\r\n\tvar wheels:Vector.\u003cWheel\u003e = car.wheels;\r\n\t\t\t\r\n\tvar owner:User = car.owner;\r\n\tvar birthday:Date = owner.birthday;\r\n}\u003c/code\u003e\u003c/pre\u003e\r\n\r\nIf you have an array of objects...\r\n\u003cpre\u003e\u003ccode\u003e[\r\n\t{ \"x\":1, \"y\":5 },\r\n\t{ \"x\":2, \"y\":4 },\r\n\t{ \"x\":3, \"y\":3 },\r\n\t{ \"x\":4, \"y\":2 },\r\n\t{ \"x\":5, \"y\":1 }\r\n]\u003c/code\u003e\u003c/pre\u003e\r\n...you can receive it as an array of strongly-typed objects by setting @resultFormat=\"array\"@ and @resultElementType=\"{ElementClass}\"@. By default, all arrays are wrapped into an @ArrayCollection@. To avoid this behavior, just set @makeObjectsBindable=\"false\"@ on the operation instance.\r\n\r\nbc. \u003cmx:HTTPOperation\r\n\tname=\"getPoints\"\r\n\turl=\"Points/[FROM]/[TO]\"\r\n\tresultFormat=\"array\"\r\n\tmakeObjectsBindable=\"false\"\r\n\tresultElementType=\"{Point}\"\r\n\tresult=\"onPointsLoaded(event)\" /\u003e\r\n\r\n\u003cpre\u003e\u003ccode\u003eprivate function onPointsLoaded(event:ResultEvent):void\r\n{\r\n\ttrace(event.result.length);\r\n\t\r\n\tfor each(var point:Point in event.result)\r\n\t\ttrace(point.x + point.y);\r\n}\u003c/code\u003e\u003c/pre\u003e\r\n\r\n@JSONSerializationFilter@ is an implementation of an abstract @TypedSerializationFilter@ that handles types transformation, while a concrete child class handles actual data serialization and deserialization.\r\n\r\nSetting @resultFormat@ to any other value, besides @array@ and @object@ (default) will result in a @JSONSerializationFilter@ (or any other @TypedSerializationFilter@) to be suppressed in a selected @HTTPOperation@.\r\n\r\nh1. XMLSerializationFilter\r\n\r\nImplements @deserializeResult@, @contentTypeProvider@ and @serializeBody@ methods.\r\n\r\nActs the same way as the @JSONSerializationFilter@. You can use the optional @xmlEncode@ and @xmlDecode@ properties to assign custom serialization methods:\r\n\r\nbc. \u003cmx:HTTPService\u003e\r\n\t\u003cmx:serializationFilter\u003e\r\n\t\t\u003crest:CompositeSerializationFilter\u003e\r\n\t\t\t\u003c!-- Serialize requests from objects to XML. --\u003e\r\n\t\t\t\u003crest:bodySerializer\u003e\r\n\t\t\t\t\u003crest:XMLSerializationFilter xmlEncode=\"{doXmlEncode}\" /\u003e\r\n\t\t\t\u003c/rest:bodySerializer\u003e\r\n\t\t\t\u003c!-- Deserialize replies from XML to strongly-typed objects. --\u003e\r\n\t\t\t\u003crest:resultDeserializer\u003e\r\n\t\t\t\t\u003crest:XMLSerializationFilter xmlDecode=\"{doXmlDecode}\" /\u003e\r\n\t\t\t\u003c/rest:resultDeserializer\u003e\r\n\t\t\t\u003c!-- Forces requests content type to be 'application/xml'. --\u003e\r\n\t\t\t\u003crest:contentTypeProvider\u003e\r\n\t\t\t\t\u003crest:RESTSerializationFilter requestContentType=\"application/xml\" /\u003e\r\n\t\t\t\u003c/rest:contentTypeProvider\u003e\r\n\t\t\t\u003c!-- This serializer is required for XML requests. --\u003e\r\n\t\t\t\u003crest:parametersSerializer\u003e\r\n\t\t\t\t\u003crest:RESTSerializationFilter /\u003e\r\n\t\t\t\u003c/rest:parametersSerializer\u003e\r\n\t\t\u003c/rest:CompositeSerializationFilter\u003e\r\n\t\u003c/mx:serializationFilter\u003e\r\n\u003c/mx:HTTPMultiService\u003e\r\n\r\n\u003cpre\u003e\u003ccode\u003eprivate function doXmlEncode(body:Object):XMLNode\r\n{\r\n\treturn new XMLNode(1, '\u003cbody id=\"' + body.id + '\"/\u003e');\r\n}\r\n\r\nprivate function doXmlDecode(node:XMLNode):Object\r\n{\r\n\treturn { id: node.attributes.id };\r\n}\u003c/code\u003e\u003c/pre\u003e\r\n\r\nh1. BasicAuthenticationSerializationFilter\r\n\r\nExtends the @CompositeSerializationFilter@ with two new properties: @username@ and @password@. Will add a basic HTTP authentication header to all requests.\r\n\r\nbc. \u003cmx:HTTPService\u003e\r\n\t\u003cmx:serializationFilter\u003e\r\n\t\t\u003crest:BasicAuthenticationSerializationFilter username=\"admin\" password=\"qwerty\"\u003e\r\n\t\t\t\u003crest:bodySerializer\u003e\r\n\t\t\t\t\u003crest:XMLSerializationFilter /\u003e\r\n\t\t\t\u003c/rest:bodySerializer\u003e\r\n\t\t\t\u003crest:resultDeserializer\u003e\r\n\t\t\t\t\u003crest:XMLSerializationFilter /\u003e\r\n\t\t\t\u003c/rest:resultDeserializer\u003e\r\n\t\t\t\u003crest:contentTypeProvider\u003e\r\n\t\t\t\t\u003crest:RESTSerializationFilter requestContentType=\"application/xml\" /\u003e\r\n\t\t\t\u003c/rest:contentTypeProvider\u003e\r\n\t\t\t\u003crest:parametersSerializer\u003e\r\n\t\t\t\t\u003crest:RESTSerializationFilter /\u003e\r\n\t\t\t\u003c/rest:parametersSerializer\u003e\r\n\t\t\u003c/rest:BasicAuthenticationSerializationFilter\u003e\r\n\t\u003c/mx:serializationFilter\u003e\r\n\u003c/mx:HTTPMultiService\u003e\r\n\r\nh1. OAuthSerializationFilter\r\n\r\nExtends the @CompositeSerializationFilter@. Can be used to create and assign an OAuth header to your requests.\r\n\r\nbc. \u003cmx:HTTPService\u003e\r\n\t\u003cmx:serializationFilter\u003e\r\n\t\t\u003crest:OAuthSerializationFilter id=\"oauthFilter\" keySecret=\"kAcSOqF21Fu85e7zjz7ZN2U4ZRhfV3WpwPAoE3Z7kBw\" tokenSecret=\"LswwdoUaIvS8ltyTt5jkRh4J50vUPVVHtR2YPi5kE\"\u003e\r\n\t\t\t\u003crest:bodySerializer\u003e\r\n\t\t\t\t\u003crest:XMLSerializationFilter /\u003e\r\n\t\t\t\u003c/rest:bodySerializer\u003e\r\n\t\t\t\u003crest:resultDeserializer\u003e\r\n\t\t\t\t\u003crest:XMLSerializationFilter /\u003e\r\n\t\t\t\u003c/rest:resultDeserializer\u003e\r\n\t\t\t\u003crest:contentTypeProvider\u003e\r\n\t\t\t\t\u003crest:RESTSerializationFilter requestContentType=\"application/xml\" /\u003e\r\n\t\t\t\u003c/rest:contentTypeProvider\u003e\r\n\t\t\t\u003crest:parametersSerializer\u003e\r\n\t\t\t\t\u003crest:RESTSerializationFilter /\u003e\r\n\t\t\t\u003c/rest:parametersSerializer\u003e\r\n\t\t\u003c/rest:BasicAuthenticationSerializationFilter\u003e\r\n\t\u003c/mx:serializationFilter\u003e\r\n\t\u003cmx:operationList\u003e\r\n\t\t\u003cmx:HTTPOperation\r\n\t\t\tname=\"getUser\"\r\n\t\t\turl=\"User/[ID]\" /\u003e\t\t\t\r\n\t\u003c/mx:operationList\u003e\r\n\u003c/mx:HTTPMultiService\u003e\r\n\r\n\u003cpre\u003e\u003ccode\u003eimport mx.rpc.AbstractOperation;\r\nimport mx.rpc.AsyncToken;\r\nimport mx.rpc.http.OAuthHeader;\r\nimport mx.rpc.utils.OAuthUtil;\r\n\t\t\r\nimport vo.User;\r\n\t\t\r\nprivate function getUser(userId:uint):AsyncToken\r\n{\r\n\tvar oauthData:OAuthHeader = new OAuthHeader();\r\n\toauthData.oauth_version = \"1.0\";\r\n\toauthData.oauth_consumer_key = \"xvz1evFS4wEEPTGEFPHBog\";\r\n\toauthData.oauth_token = \"370773112-GmHxMAgYyLbNEtIKZeRNFsMKPR9EyMZeS9weJAEb\";\r\n\toauthData.oauth_nonce = OAuthUtil.generateNonce();\r\n\toauthData.oauth_signature_method = OAuthHeader.SIGNATURE_METHOD_HMAC_SHA1;\r\n\toauthData.oauth_timestamp = OAuthUtil.getTimestamp();\r\n\r\n\tvar operation:AbstractOperation = service.getOperation(\"getUser\");\r\n\toperation.arguments = { ID: userId }; //replace URL tokens\r\n\r\n\toauthFilter.oauthData = oauthData;\r\n\r\n\treturn operation.send();\r\n}\u003c/code\u003e\u003c/pre\u003e\r\n\r\n---\r\n\r\nStatic @mx.utils.TypeUtil@ class can be used for all type castings listed above.\r\n\r\n@mx.rpc.OperationResponder@ can be used to make operation handlers more straightforward. It mimics Flex's @AsyncResponder@ class, but with a different result/fault functions signatures. A valid result handler signature is @function(valueObject:Object):void@. A result handler function will receive @ResultEvent.result@ value, so you can just set your result type in a handler: @function(valueObject:MyResultClass):void@. A valid fault handler signature is @function(fault:Fault):void@.\r\n\r\n\u003cpre\u003e\u003ccode\u003eimport mx.rpc.OperationResponder;\r\n\t\t\r\nimport vo.User;\r\n\t\t\r\nprivate function getUser():void\r\n{\t\r\n\tservice.getOperation(\"getUser\").send().addResponder(new OperationResponder(onResult, onFault));\r\n}\r\n\r\nprivate function onResult(user:User):void\r\n{\r\n\ttrace(user.firstName);\r\n}\r\n\r\nprivate function onFault(fault:Fault):void\r\n{\r\n\ttrace(fault.faultDetail);\r\n}\u003c/code\u003e\u003c/pre\u003e\r\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fartema%2Fflexrest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fartema%2Fflexrest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fartema%2Fflexrest/lists"}