This is an automated email from the ASF dual-hosted git repository.
gregdove pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
The following commit(s) were added to refs/heads/develop by this push:
new 47b6bf8 [Fixes:CompressedRemoteObject] updates to
CompressedRemoteObject in royale to correspond to updates in AMF-related
networking support. MXRoyale changes: CompressedRemoteObject also needs to be
dynamic. And the mxml version needs to inherit from the mxml version of
RemoteObject (because of a 'if (remoteObject is
mx.rpc.remoting.mxml.RemoteObject)' in Operation's resultHandler code)
47b6bf8 is described below
commit 47b6bf8dd03825f79084857d26015593b6bce9d9
Author: greg-dove <[email protected]>
AuthorDate: Mon Mar 11 13:11:23 2019 +1300
[Fixes:CompressedRemoteObject] updates to CompressedRemoteObject in royale
to correspond to updates in AMF-related networking support.
MXRoyale changes: CompressedRemoteObject also needs to be dynamic. And the
mxml version needs to inherit from the mxml version of RemoteObject (because of
a 'if (remoteObject is mx.rpc.remoting.mxml.RemoteObject)' in Operation's
resultHandler code)
---
.../RemoteObjectAMFTest/src/main/royale/App.mxml | 21 ++++-----
.../src/main/resources/mx-royale-manifest.xml | 12 ++---
.../mx/rpc/remoting/CompressedRemoteObject.as | 50 ++++++++++-----------
.../remoting/{ => mxml}/CompressedRemoteObject.as | 52 +++++++++++-----------
.../apache/royale/net/CompressedRemoteObject.as | 22 ++++-----
5 files changed, 78 insertions(+), 79 deletions(-)
diff --git a/examples/mxroyale/RemoteObjectAMFTest/src/main/royale/App.mxml
b/examples/mxroyale/RemoteObjectAMFTest/src/main/royale/App.mxml
index ac5911e..a68c15b 100644
--- a/examples/mxroyale/RemoteObjectAMFTest/src/main/royale/App.mxml
+++ b/examples/mxroyale/RemoteObjectAMFTest/src/main/royale/App.mxml
@@ -187,9 +187,11 @@ limitations under the License.
<mx:RemoteObject id="serviceResp" fault="onFault(event)"
endpoint="http://localhost:8080/messagebroker/websocket-amf"
destination="exampleService"/>
- <!-- <mx:CompressedRemoteObject id="compressedService"
fault="onFault(event)"
+ <mx:CompressedRemoteObject id="compressedService"
fault="onFault(event)"
endpoint="http://localhost:8080/messagebroker/websocket-amf"
- destination="compressedService"/> -->
+ destination="compressedService">
+
+ </mx:CompressedRemoteObject>
</fx:Declarations>
<mx:beads>
@@ -218,16 +220,6 @@ limitations under the License.
</mx:HBox>
<mx:Label id="result_txt" height="15"/>
</mx:VBox>
- <!-- <mx:VBox width="400">
- <mx:HBox>
- <mx:VBox>
- <mx:Label text="Name to send via AMF (With Compression)"/>
- <mx:TextInput id="nameCompress_txt"/>
- </mx:VBox>
- <mx:Button label="Send to Name (With Compression)"
click="compressedSendEcho(event)"/>
- </mx:HBox>
- <mx:Label id="resultCompress_txt"/>
- </mx:VBox> -->
<mx:VBox width="400">
<mx:Button label="Get Array Of Objects"
click="service.getObjectArray1()"/>
<mx:List id="list" labelField="id" width="100%" height="200"
@@ -239,6 +231,11 @@ limitations under the License.
<mx:Label text="{((service.getSomeProduct as Operation).lastResult as
Product).name}" height="15"/>
</mx:VBox>
<mx:VBox width="400">
+ <mx:Button label="(CompressedRO) Get Some Product"
click="compressedService.getSomeCompressedProduct()"/>
+ <mx:Label text="{((compressedService.getSomeCompressedProduct as
Operation).lastResult as Product).name}" height="15"/>
+ </mx:VBox>
+
+ <mx:VBox width="400">
<mx:Button label="Send client vo to java" click="sendClientVO(event)"/>
<!-- <mx:Label text="{(service.sendSomeProduct as
Operation).lastResult as String}"/> -->
<mx:Label id="result2_txt" height="15"/>
diff --git
a/frameworks/projects/MXRoyale/src/main/resources/mx-royale-manifest.xml
b/frameworks/projects/MXRoyale/src/main/resources/mx-royale-manifest.xml
index d4d68da..405ac2a 100644
--- a/frameworks/projects/MXRoyale/src/main/resources/mx-royale-manifest.xml
+++ b/frameworks/projects/MXRoyale/src/main/resources/mx-royale-manifest.xml
@@ -21,7 +21,7 @@
<componentPackage>
- <component id="Application" class="mx.core.Application" />
+ <component id="Application" class="mx.core.Application" />
<component id="Button" class="mx.controls.Button" />
<component id="CheckBox" class="mx.controls.CheckBox" />
<component id="ComboBox" class="mx.controls.ComboBox" />
@@ -49,14 +49,14 @@
<component id="VBox" class="mx.containers.VBox" />
<component id="VDividedBox" class="mx.containers.VDividedBox" />
<component id="Panel" class="mx.containers.Panel" />
- <component id="ViewStack" class="mx.containers.ViewStack" />
+ <component id="ViewStack" class="mx.containers.ViewStack" />
<component id="TabNavigator" class="mx.containers.TabNavigator" />
<component id="ApplicationLayout"
class="mx.containers.beads.ApplicationLayout" />
<component id="BoxLayout" class="mx.containers.beads.BoxLayout" />
<component id="CanvasLayout" class="mx.containers.beads.CanvasLayout" />
<component id="TitleWindow" class="mx.containers.TitleWindow"/>
<component id="ColorPicker" class="mx.controls.ColorPicker"/>
- <component id="CompressedRemoteObject"
class="mx.rpc.remoting.CompressedRemoteObject" />
+ <component id="CompressedRemoteObject"
class="mx.rpc.remoting.mxml.CompressedRemoteObject" />
<component id="RemoteObject" class="mx.rpc.remoting.mxml.RemoteObject"
/>
<component id="RemoteObjectOperation"
class="mx.rpc.remoting.mxml.Operation"/>
<component id="HTTPService" class="mx.rpc.http.mxml.HTTPService" />
@@ -127,10 +127,10 @@
<component id="AdvancedDataGridItemRenderer"
class="mx.controls.advancedDataGridClasses.AdvancedDataGridItemRenderer" />
<component id="Tree" class="mx.controls.Tree"/>
<component id="LinkBar" class="mx.controls.LinkBar"/>
-
+
<component id="AMFChannel" class="mx.messaging.channels.AMFChannel" />
<component id="ChannelSet" class="mx.messaging.ChannelSet" />
-
+
<component id="ListCollectionView"
class="mx.collections.ListCollectionView"/>
<component id="ArrayCollection" class="mx.collections.ArrayCollection"/>
<component id="Alert" class="mx.controls.Alert" />
@@ -203,7 +203,7 @@
<component id="CartesianDataCanvas"
class="mx.charts.chartClasses.CartesianDataCanvas"/>
<component id="PolarDataCanvas"
class="mx.charts.chartClasses.PolarDataCanvas"/>
-
+
<component id="GroupingCollection"
class="mx.collections.GroupingCollection"/>
<component id="GroupingCollection2"
class="mx.collections.GroupingCollection2"/>
diff --git
a/frameworks/projects/MXRoyale/src/main/royale/mx/rpc/remoting/CompressedRemoteObject.as
b/frameworks/projects/MXRoyale/src/main/royale/mx/rpc/remoting/CompressedRemoteObject.as
index 96b46da..55ffe1b 100644
---
a/frameworks/projects/MXRoyale/src/main/royale/mx/rpc/remoting/CompressedRemoteObject.as
+++
b/frameworks/projects/MXRoyale/src/main/royale/mx/rpc/remoting/CompressedRemoteObject.as
@@ -35,7 +35,7 @@ package mx.rpc.remoting
* It deserializes the compressed ByteArray in order to optimize the
transfer time.
* TODO improve to serialize the sending.
*/
- public class CompressedRemoteObject extends RemoteObject
+ public dynamic class CompressedRemoteObject extends RemoteObject
{
/**
* disable the compression if true
@@ -153,36 +153,36 @@ package mx.rpc.remoting
}
return parameters;
}
-
- private function deserializeResult(result:*,
operation:AbstractOperation):* // NO PMD
+
+ /**
+ * @royaleignorecoercion
org.apache.royale.net.remoting.amf.AMFBinaryData
+ */
+ private function deserializeResult(result:*,
operation:AbstractOperation):* // NO PMD
{
COMPILE::SWF{
- if (!disableCompression && result is ByteArray) {
- var byteArray:ByteArray = result as ByteArray;
- byteArray.uncompress();
- return byteArray.readObject();
- } else {
- return result;
- }
+ if (!disableCompression && result is ByteArray) {
+ var byteArray:ByteArray = result as ByteArray;
+ byteArray.uncompress();
+ return byteArray.readObject();
+ } else {
+ return result;
+ }
}
COMPILE::JS
{
- if (!disableCompression && result is Array)
- {
- // --- Transform the number array into a bytearray
- var bytearray:Uint8Array = new Uint8Array(result);
- // --- uncompress the bytearray to get the real object (tree)
and create the AMFBinaryData with it
- var data:AMFBinaryData = new
AMFBinaryData(window["pako"]["inflate"](bytearray));
- // --- store the inflated data object in result
- result = data.readObject();
-
- return result;
- }
- else
- {
- return result;
- }
+ if (!disableCompression && result is AMFBinaryData)
+ {
+ var original:AMFBinaryData = result as
AMFBinaryData;
+ // --- uncompress the original bytes to
get the real object (tree) and create a new AMFBinaryData with it
+ var uncompressed:AMFBinaryData = new
AMFBinaryData(window["pako"]["inflate"](original.array).buffer);
+ // --- return the inflated data object as result
+ return uncompressed.readObject();
+ }
+ else
+ {
+ return result;
+ }
}
}
}
diff --git
a/frameworks/projects/MXRoyale/src/main/royale/mx/rpc/remoting/CompressedRemoteObject.as
b/frameworks/projects/MXRoyale/src/main/royale/mx/rpc/remoting/mxml/CompressedRemoteObject.as
similarity index 84%
copy from
frameworks/projects/MXRoyale/src/main/royale/mx/rpc/remoting/CompressedRemoteObject.as
copy to
frameworks/projects/MXRoyale/src/main/royale/mx/rpc/remoting/mxml/CompressedRemoteObject.as
index 96b46da..07c9923 100644
---
a/frameworks/projects/MXRoyale/src/main/royale/mx/rpc/remoting/CompressedRemoteObject.as
+++
b/frameworks/projects/MXRoyale/src/main/royale/mx/rpc/remoting/mxml/CompressedRemoteObject.as
@@ -16,7 +16,7 @@
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////////
-package mx.rpc.remoting
+package mx.rpc.remoting.mxml
{
COMPILE::SWF
{
@@ -35,7 +35,7 @@ package mx.rpc.remoting
* It deserializes the compressed ByteArray in order to optimize the
transfer time.
* TODO improve to serialize the sending.
*/
- public class CompressedRemoteObject extends RemoteObject
+ public dynamic class CompressedRemoteObject extends RemoteObject
{
/**
* disable the compression if true
@@ -153,36 +153,36 @@ package mx.rpc.remoting
}
return parameters;
}
-
- private function deserializeResult(result:*,
operation:AbstractOperation):* // NO PMD
+
+ /**
+ * @royaleignorecoercion
org.apache.royale.net.remoting.amf.AMFBinaryData
+ */
+ private function deserializeResult(result:*,
operation:AbstractOperation):* // NO PMD
{
COMPILE::SWF{
- if (!disableCompression && result is ByteArray) {
- var byteArray:ByteArray = result as ByteArray;
- byteArray.uncompress();
- return byteArray.readObject();
- } else {
- return result;
- }
+ if (!disableCompression && result is ByteArray) {
+ var byteArray:ByteArray = result as ByteArray;
+ byteArray.uncompress();
+ return byteArray.readObject();
+ } else {
+ return result;
+ }
}
COMPILE::JS
{
- if (!disableCompression && result is Array)
- {
- // --- Transform the number array into a bytearray
- var bytearray:Uint8Array = new Uint8Array(result);
- // --- uncompress the bytearray to get the real object (tree)
and create the AMFBinaryData with it
- var data:AMFBinaryData = new
AMFBinaryData(window["pako"]["inflate"](bytearray));
- // --- store the inflated data object in result
- result = data.readObject();
-
- return result;
- }
- else
- {
- return result;
- }
+ if (!disableCompression && result is AMFBinaryData)
+ {
+ var original:AMFBinaryData = result as
AMFBinaryData;
+ // --- uncompress the original bytes to
get the real object (tree) and create a new AMFBinaryData with it
+ var uncompressed:AMFBinaryData = new
AMFBinaryData(window["pako"]["inflate"](original.array).buffer);
+ // --- return the inflated data object as result
+ return uncompressed.readObject();
+ }
+ else
+ {
+ return result;
+ }
}
}
}
diff --git
a/frameworks/projects/Network/src/main/royale/org/apache/royale/net/CompressedRemoteObject.as
b/frameworks/projects/Network/src/main/royale/org/apache/royale/net/CompressedRemoteObject.as
index 19e86d2..64a5313 100644
---
a/frameworks/projects/Network/src/main/royale/org/apache/royale/net/CompressedRemoteObject.as
+++
b/frameworks/projects/Network/src/main/royale/org/apache/royale/net/CompressedRemoteObject.as
@@ -55,18 +55,20 @@ package org.apache.royale.net
* @royalesuppresspublicvarwarning
*/
public static var disableCompression:Boolean;
-
- override public function resultHandler(param:Object):void
+
+ /**
+ * @royaleignorecoercion
org.apache.royale.net.remoting.amf.AMFBinaryData
+ */
+ override public function resultHandler(param:Object):void
{
COMPILE::JS
{
- if(!disableCompression) {
- // --- Transform the number array into a bytearray
- var bytearray:Uint8Array = new Uint8Array(param.body);
-
- // --- uncompress the bytearray to get the real object
(tree) and create the AMFBinaryData with it
- var data:AMFBinaryData = new
AMFBinaryData(window["pako"]["inflate"](bytearray).buffer);
- param.body = data.readObject();
+ if(!disableCompression && param.body is AMFBinaryData) {
+ var original:AMFBinaryData = param.body as AMFBinaryData;
+
+ // --- uncompress the original bytes to get the real
object (tree) and create a new AMFBinaryData with it
+ var uncompressed:AMFBinaryData = new
AMFBinaryData(window["pako"]["inflate"](original.array).buffer);
+ param.body = uncompressed.readObject();
}
// --- dispatch the ResultEvent like in the standard
RemoteObject with the inflated result object
dispatchEvent(new ResultEvent(ResultEvent.RESULT,
param.body));
@@ -75,7 +77,7 @@ package org.apache.royale.net
COMPILE::SWF
{
// --- SWF not tested
- if(!disableCompression) {
+ if(!disableCompression && param.body is ByteArray) {
var byteArray:ByteArray = param.body as ByteArray;
byteArray.uncompress();
dispatchEvent(new ResultEvent(ResultEvent.RESULT,
byteArray.readObject()));