You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ah...@apache.org on 2014/04/25 07:34:22 UTC

[24/51] [partial] BlazeDS Donation from Adobe Systems Inc

http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/7a58369c/apps/team/features/messaging/throttle/messaging_ThrottleInbound.mxml
----------------------------------------------------------------------
diff --git a/apps/team/features/messaging/throttle/messaging_ThrottleInbound.mxml b/apps/team/features/messaging/throttle/messaging_ThrottleInbound.mxml
new file mode 100755
index 0000000..b14661f
--- /dev/null
+++ b/apps/team/features/messaging/throttle/messaging_ThrottleInbound.mxml
@@ -0,0 +1,155 @@
+<?xml version="1.0"?>
+<!--
+
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+
+-->
+<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="100%"
+    creationComplete="creationCompleteHandler();">
+
+    <!-- A sample that one can use to talk to messaging destinations with inbound
+         throttling and ERROR or IGNORE policies using different channels supported
+         by BlazeDS. Destinations have low inbound throttling limits and the sample
+         can be used to generate high number of message to see inbound throttling
+         handled according to the policy.
+     -->
+    <mx:Panel id="mainPanel" height="100%" width="100%">
+        <mx:HBox>
+            <mx:Label text="Destination to use "/>
+            <mx:ComboBox id="destinationsCB" dataProvider="{destinations}" selectedIndex="0" width="300"
+                change="setupChannelsCB();"/>
+        </mx:HBox>
+        <mx:HBox>
+            <mx:Label text="Channel to use "/>
+            <mx:ComboBox id="channelsCB" selectedIndex="0" width="200"
+                change="setupComponents()"/>
+        </mx:HBox>
+        <mx:HBox>
+            <mx:Label text="Producer"/>
+            <mx:Button label="Send 10 Foo{counter}" click="sendMessage(10)"/>
+            <mx:Button label="Disconnect" click="producer.disconnect();" enabled="{producer.connected}"/>
+            <mx:CheckBox label="Connected?" selected="{producer.connected}"/>
+        </mx:HBox>
+        <mx:HBox>
+            <mx:Label text="Consumer"/>
+            <mx:Button label="Subcribe" click="consumer.subscribe();" enabled="{!consumer.subscribed}"/>
+            <mx:Button label="Unsubscribe" click="consumer.unsubscribe();" enabled="{consumer.subscribed}"/>
+            <mx:Button label="Disconnect" click="consumer.disconnect();" enabled="{consumer.connected}"/>
+            <mx:CheckBox label="Connected?" selected="{consumer.connected}"/>
+            <mx:CheckBox label="Subscribed?" selected="{consumer.subscribed}"/>
+        </mx:HBox>
+        <mx:HBox width="100%">
+            <mx:Spacer width="100%"/>
+            <mx:CheckBox id="dmCB" label="Display received messages?" selected="{displayMessages}"/>
+            <mx:Button label="Clear" click='output.text = ""'/>
+        </mx:HBox>
+        <mx:TextArea id="output" width="100%" height="100%"/>
+    </mx:Panel>
+
+    <mx:Binding source="dmCB.selected" destination="displayMessages"/>
+
+    <mx:Producer id="producer"
+        fault="producerFaultHandler(event)"/>
+
+    <mx:Consumer id="consumer"
+        fault="consumerFaultHandler(event)"
+        message="consumerMessageHandler(event)"/>
+
+    <mx:Script>
+        <![CDATA[
+            import mx.collections.ArrayCollection;
+            import mx.messaging.ChannelSet;
+            import mx.messaging.config.ServerConfig;
+            import mx.messaging.events.MessageFaultEvent;
+            import mx.messaging.events.MessageEvent;
+            import mx.messaging.messages.AsyncMessage;
+
+            import mx.logging.Log;
+            import mx.logging.targets.TraceTarget;
+
+            [Bindable]
+            public var counter:int = 0;
+
+            [Bindable]
+            public var destinations:Array = ['messaging_ThrottleInbound_PolicyError',
+                                             'messaging_ThrottleInbound_PolicyIgnore'];
+            [Bindable]
+            public var destinationId:String;
+            [Bindable]
+            public var displayMessages:Boolean;
+
+
+            private function creationCompleteHandler():void
+            {
+                var target:TraceTarget = new TraceTarget();
+                target.includeLevel = true;
+                target.filters = ["mx.messaging.*", "mx.rpc.*"];
+                Log.addTarget(target);
+
+                displayMessages = true;
+                setupChannelsCB();
+                setupComponents();
+            }
+
+            private function setupChannelsCB():void
+            {
+                destinationId = destinationsCB.selectedLabel;
+                channelsCB.dataProvider = new ArrayCollection((ServerConfig.getChannelSet(destinationId) as ChannelSet).channelIds);
+            }
+
+            private function setupComponents():void
+            {
+                // Setup consumer.
+                consumer.unsubscribe();
+                consumer.destination = destinationId;
+                var cs:ChannelSet = new ChannelSet();
+                cs.addChannel(ServerConfig.getChannel(channelsCB.selectedItem.toString()));
+                consumer.channelSet = cs;
+
+                // Setup producer.
+                producer.destination = destinationId;
+                producer.channelSet = cs;
+            }
+
+            private function sendMessage(n:int=1):void
+            {
+                var msg:AsyncMessage = null;
+                for (var i:int = 0; i < n; i++)
+                {
+                    msg = new AsyncMessage();
+                    msg.body = "Foo" + counter++;
+                    producer.send(msg);
+                }
+            }
+
+            private function consumerMessageHandler(event:MessageEvent):void
+            {
+                if (displayMessages)
+                    output.text += "Consumer received message: "+ event.message.body + "\n";
+            }
+
+            private function consumerFaultHandler(event:MessageFaultEvent):void
+            {
+                output.text += "Consumer received fault: " + event.faultString + "\n";
+            }
+
+            private function producerFaultHandler(event:MessageFaultEvent):void
+            {
+                output.text += "Producer received fault: " + event.faultString + "\n";
+            }
+        ]]>
+    </mx:Script>
+</mx:Application>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/7a58369c/apps/team/features/messaging/throttle/messaging_ThrottleOutbound.mxml
----------------------------------------------------------------------
diff --git a/apps/team/features/messaging/throttle/messaging_ThrottleOutbound.mxml b/apps/team/features/messaging/throttle/messaging_ThrottleOutbound.mxml
new file mode 100755
index 0000000..5fbbaf9
--- /dev/null
+++ b/apps/team/features/messaging/throttle/messaging_ThrottleOutbound.mxml
@@ -0,0 +1,228 @@
+<?xml version="1.0"?>
+<!--
+
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+
+-->
+<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="100%"
+    creationComplete="creationCompleteHandler();">
+
+    <!-- A sample that one can use to talk to messaging destinations with outbound
+         throttling and IGNORE policy using different channels supported by BlazeDS.
+         Destinations have low outbound throttling limits and the sample
+         can be used to generate high number of message to see outbound throttling
+         handled according to the policy.
+     -->
+    <mx:Panel id="mainPanel" height="100%" width="100%">
+        <mx:HBox>
+            <mx:Label text="Destination to use "/>
+            <mx:ComboBox id="destinationsCB" dataProvider="{destinations}" selectedIndex="0" width="300"
+                change="setupChannelsCB();"/>
+        </mx:HBox>
+        <mx:HBox>
+            <mx:Label text="Channel to use "/>
+            <mx:ComboBox id="channelsCB" selectedIndex="0" width="200"
+                change="setupComponents();"/>
+            <mx:Button label="Poll" click="poll()"
+                enabled="{!currentChannel.mx_internal::realtime}"/>
+        </mx:HBox>
+        <mx:HBox>
+            <mx:Label text="Push messages"/>
+            <mx:Label text="Push rate per second"/>
+            <mx:TextInput id="ti1" width="50" text="10"/>
+            <mx:Label text="Number of runs"/>
+            <mx:TextInput id="ti2" width="50" text="-1"/>
+            <mx:Button label="Start push" click="startPush();"/>
+            <mx:Button label="Stop push" click="stopPush();"/>
+        </mx:HBox>
+        <mx:HBox>
+            <mx:Label text="Consumer"/>
+            <mx:Button label="Subcribe" click="consumerSubscribe();" enabled="{!consumer.subscribed}"/>
+            <mx:Button label="Unsubscribe" click="consumerUnsubscribe();" enabled="{consumer.subscribed}"/>
+            <mx:Button label="Disconnect" click="consumer.disconnect();" enabled="{consumer.connected}"/>
+            <mx:CheckBox label="Connected?" selected="{consumer.connected}"/>
+            <mx:CheckBox label="Subscribed?" selected="{consumer.subscribed}"/>
+        </mx:HBox>
+        <mx:HBox>
+            <mx:Label text="Message receive rate"/>
+            <mx:Label text="In the last second: {currentRate.toFixed(2)}m/s"/>
+            <mx:Label text="Since subscribe: {globalRate.toFixed(2)}m/s"/>
+        </mx:HBox>
+        <mx:HBox width="100%">
+            <mx:Spacer width="100%"/>
+            <mx:CheckBox id="dmCB" label="Display received messages?" selected="{displayMessages}"/>
+            <mx:Button label="Clear" click='output.text = ""'/>
+        </mx:HBox>
+        <mx:TextArea id="output" width="100%" height="100%"/>
+    </mx:Panel>
+
+    <mx:Binding source="dmCB.selected" destination="displayMessages"/>
+
+    <mx:RemoteObject id="serverPushRO" destination="serverPushRO"/>
+
+    <mx:Consumer id="consumer"
+        fault="consumerFaultHandler(event)"
+        message="consumerMessageHandler(event)"/>
+
+    <mx:Script>
+        <![CDATA[
+            import mx.collections.ArrayCollection;
+            import mx.core.mx_internal;
+            import mx.messaging.ChannelSet;
+            import mx.messaging.Channel;
+            import mx.messaging.channels.PollingChannel;
+            import mx.messaging.config.ServerConfig;
+            import mx.messaging.events.MessageFaultEvent;
+            import mx.messaging.events.MessageEvent;
+            import mx.messaging.messages.AsyncMessage;
+
+            import mx.logging.Log;
+            import mx.logging.targets.TraceTarget;
+
+            [Bindable]
+            public var currentChannel:Channel;
+            [Bindable]
+            public var destinations:Array = ['messaging_ThrottleOutbound_PolicyIgnore'];
+            [Bindable]
+            public var destinationId:String;
+            [Bindable]
+            public var displayMessages:Boolean;
+
+            // How often to measure the message rate.
+            public const MEASUREMENT_TIME_MILLIS:int = 1000;
+            private var measurementTimer:Timer;
+
+            // Used to keep track of global message receive rate since subscription.
+            [Bindable]
+            public var globalRate:Number;
+            private var globalStartTime:Number;
+            private var globalMessages:int;
+
+            // Used to keep track of message receive rate in the last second.
+            [Bindable]
+            private var currentRate:Number;
+            [Bindable]
+            private var interval:Number;
+            private var startTime:int = 0;
+            private var currentMessages:int;
+
+            private function creationCompleteHandler():void
+            {
+                var target:TraceTarget = new TraceTarget();
+                target.includeLevel = true;
+                target.filters = ["mx.messaging.*", "mx.rpc.*"];
+                Log.addTarget(target);
+
+                displayMessages = true;
+                setupChannelsCB();
+                setupComponents();
+
+                measurementTimer = new Timer(MEASUREMENT_TIME_MILLIS, 0);
+                measurementTimer.addEventListener(TimerEvent.TIMER, measurementTimerHandler);
+            }
+
+            private function setupChannelsCB():void
+            {
+                destinationId = destinationsCB.selectedLabel;
+                channelsCB.dataProvider = new ArrayCollection((ServerConfig.getChannelSet(destinationId) as ChannelSet).channelIds);
+            }
+
+            private function setupComponents():void
+            {
+                currentChannel = ServerConfig.getChannel(channelsCB.selectedItem.toString());
+
+                consumer.unsubscribe();
+                consumer.destination = destinationId;
+                var cs:ChannelSet = new ChannelSet();
+                cs.addChannel(currentChannel);
+                consumer.channelSet = cs;
+            }
+
+            private function consumerSubscribe():void
+            {
+                globalStartTime = getTimer();
+                globalMessages = 0;
+                currentMessages = 0;
+                startTime = 0;
+
+                if (!measurementTimer.running)
+                    measurementTimer.start();
+
+                consumer.subscribe();
+            }
+
+            private function consumerUnsubscribe():void
+            {
+                globalRate = 0;
+                currentRate = 0;
+                if (measurementTimer.running)
+                    measurementTimer.stop();
+                if (consumer.subscribed)
+                    consumer.unsubscribe();
+            }
+
+            private function consumerMessageHandler(event:MessageEvent):void
+            {
+                currentMessages++;
+                globalMessages++;
+
+                if (displayMessages)
+                    output.text += "Consumer received message: "+ event.message.body + "\n";
+            }
+
+            private function consumerFaultHandler(event:MessageFaultEvent):void
+            {
+                output.text += "Consumer received fault: " + event.faultString + "\n";
+            }
+
+            private function measurementTimerHandler(event:TimerEvent):void
+            {
+                var now:int = getTimer();
+                if (startTime == 0)
+                {
+                    globalStartTime = now;
+                    startTime = now;
+                }
+
+                var temp:Number = Number(now - startTime);
+                if (temp >= MEASUREMENT_TIME_MILLIS)
+                {
+                    interval = temp;
+                    currentRate = 1000.0 * currentMessages / interval;
+                    globalRate = 1000.0 * globalMessages / Number(now - globalStartTime);
+                    currentMessages = 0;
+                    startTime = now;
+                }
+            }
+
+            private function startPush():void
+            {
+                serverPushRO.startPush(destinationId, uint(ti1.text), 1000, uint(ti2.text));
+            }
+
+            private function stopPush():void
+            {
+                serverPushRO.stopPush();
+            }
+
+            private function poll():void
+            {
+                output.text += "Polling" + "\n";
+                (currentChannel as PollingChannel).poll();
+            }
+        ]]>
+    </mx:Script>
+</mx:Application>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/7a58369c/apps/team/features/remoting/externalizable/ExternalizableClass.as
----------------------------------------------------------------------
diff --git a/apps/team/features/remoting/externalizable/ExternalizableClass.as b/apps/team/features/remoting/externalizable/ExternalizableClass.as
new file mode 100755
index 0000000..fefddd5
--- /dev/null
+++ b/apps/team/features/remoting/externalizable/ExternalizableClass.as
@@ -0,0 +1,56 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package
+{
+    import flash.utils.IDataInput;
+    import flash.utils.IDataOutput;
+    import flash.utils.IExternalizable;
+
+    /**
+     * A simple class that uses IExternalizable interface to read and write its properties.
+     */ 
+    [RemoteClass(alias="features.remoting.externalizable.ExternalizableClass")]
+    public class ExternalizableClass implements IExternalizable
+    {
+        public var property1:String;
+        public var property2:String;
+
+        public function ExternalizableClass()
+        {
+        }
+
+        public function readExternal(input:IDataInput):void
+        {
+            property1 = input.readObject() as String;
+            property2 = input.readObject() as String;
+        }
+
+        public function writeExternal(output:IDataOutput):void
+        {
+            output.writeObject(property1);
+            output.writeObject(property2);
+        }
+
+        public function toString():String
+        {
+            return "ExternalizableClass [property1: " + property1 + ", property2: " + property2 + "]";
+        }
+        
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/7a58369c/apps/team/features/remoting/externalizable/remoting_Externalizable.mxml
----------------------------------------------------------------------
diff --git a/apps/team/features/remoting/externalizable/remoting_Externalizable.mxml b/apps/team/features/remoting/externalizable/remoting_Externalizable.mxml
new file mode 100755
index 0000000..25cd31d
--- /dev/null
+++ b/apps/team/features/remoting/externalizable/remoting_Externalizable.mxml
@@ -0,0 +1,80 @@
+<?xml version="1.0"?>
+<!--
+
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+
+-->
+<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="100%"
+    creationComplete="creationCompleteHandler();">
+    
+    <!-- 
+        A remoting example that sends and receives classes that use Externalizable
+        interfaces to read and writes their properties.
+    -->
+    <mx:Panel id="mainPanel" height="100%" width="100%">
+        <mx:HBox>
+            <mx:Label text="Enter properties of the ExternalizableClass"/>
+            <mx:TextInput id="ti1" text="property1"/>
+            <mx:TextInput id="ti2" text="property2"/>
+            <mx:Button label="Send" click="echo()"/>
+            <mx:Button label="Clear" click='ta.text = ""'/>
+        </mx:HBox>	
+        <mx:TextArea id="ta" width="100%" height="100%"/>
+    </mx:Panel>
+
+    <mx:RemoteObject id="remoteObject" 
+        destination="remoting_AMF"
+        result="resultHandler(event)"
+        fault="faultHandler(event)"/>
+
+    <mx:Script>
+        <![CDATA[
+            import mx.logging.Log;
+            import mx.logging.targets.TraceTarget;
+            import mx.rpc.events.FaultEvent;
+            import mx.rpc.events.ResultEvent;
+
+            private var value:ExternalizableClass = new ExternalizableClass();
+
+            private function creationCompleteHandler():void
+            {
+                var target:TraceTarget = new TraceTarget();
+                target.includeLevel = true;
+                target.filters = ["mx.messaging.*", "mx.rpc.*"];
+                Log.addTarget(target);
+            }
+
+            private function echo():void
+            {
+                value.property1 = ti1.text;
+                value.property2 = ti2.text;
+                remoteObject.echoExternalizableClass(value);
+            }
+
+            private function resultHandler(event:ResultEvent):void
+            {
+                var returnedValue:ExternalizableClass = event.result as ExternalizableClass;
+                ta.text += "Server responded: "  + returnedValue + "\n";
+            }
+
+            private function faultHandler(event:FaultEvent):void
+            {
+                ta.text += "Received fault: " + event.fault + "\n";
+            }
+        ]]>
+    </mx:Script>
+
+</mx:Application>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/7a58369c/apps/team/features/remoting/filteredAckRemoting.mxml
----------------------------------------------------------------------
diff --git a/apps/team/features/remoting/filteredAckRemoting.mxml b/apps/team/features/remoting/filteredAckRemoting.mxml
new file mode 100755
index 0000000..1a888aa
--- /dev/null
+++ b/apps/team/features/remoting/filteredAckRemoting.mxml
@@ -0,0 +1,77 @@
+<?xml version="1.0"?>
+<!--
+
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+
+-->
+<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="100%"
+    creationComplete="creationCompleteHandler();">
+    
+    <!-- A simple remoting sample where client sends a text and server simply
+         echoes it back using an AMF channel.
+    -->
+    <mx:Panel id="mainPanel" height="100%" width="100%">
+        <mx:HBox>    
+        	<mx:Label text="Enter a text for the server to echo"/>        
+            <mx:TextInput id="ti" text="Hello World!"/>
+        	<mx:Button label="Send" click="echo()"/>
+            <mx:Button label="Clear" click='ta.text = ""'/>                	
+        </mx:HBox>        	
+        <mx:TextArea id="ta" width="100%" height="100%"/>           
+    </mx:Panel>
+
+    <mx:RemoteObject id="remoteObject" 
+        destination="filteredAck"
+        result="resultHandler(event)"
+        fault="faultHandler(event)"/>
+                    
+    <mx:Script>
+        <![CDATA[
+        
+    	    import mx.rpc.events.FaultEvent;	                
+            import mx.rpc.events.ResultEvent;
+            
+			import mx.logging.Log;
+	        import mx.logging.targets.TraceTarget;			
+	        					
+    		private function creationCompleteHandler():void
+    		{
+                var target:TraceTarget = new TraceTarget();
+		        target.includeLevel = true;
+		        target.filters = ["mx.messaging.*", "mx.rpc.*"];
+		        Log.addTarget(target);            			
+    		}
+    		     		 
+            private function echo():void
+            {
+                var text:String = ti.text;
+                remoteObject.echo(text);
+            }
+                                                            
+            private function resultHandler(event:ResultEvent):void
+            {
+                ta.text += "Server responded: "+ event.result + "\n";  
+            }
+                       
+            private function faultHandler(event:FaultEvent):void
+            {
+                ta.text += "Received fault: " + event.fault + "\n";
+            }      
+            
+        ]]>
+    </mx:Script>
+
+</mx:Application>

http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/7a58369c/apps/team/features/remoting/filteredFaultRemoting.mxml
----------------------------------------------------------------------
diff --git a/apps/team/features/remoting/filteredFaultRemoting.mxml b/apps/team/features/remoting/filteredFaultRemoting.mxml
new file mode 100755
index 0000000..586ddf8
--- /dev/null
+++ b/apps/team/features/remoting/filteredFaultRemoting.mxml
@@ -0,0 +1,77 @@
+<?xml version="1.0"?>
+<!--
+
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+
+-->
+<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="100%"
+    creationComplete="creationCompleteHandler();">
+    
+    <!-- A simple remoting sample where client sends a text and server simply
+         echoes it back using an AMF channel.
+    -->
+    <mx:Panel id="mainPanel" height="100%" width="100%">
+        <mx:HBox>    
+        	<mx:Label text="Enter a text for the server to echo"/>        
+            <mx:TextInput id="ti" text="Hello World!"/>
+        	<mx:Button label="Send" click="echo()"/>
+            <mx:Button label="Clear" click='ta.text = ""'/>                	
+        </mx:HBox>        	
+        <mx:TextArea id="ta" width="100%" height="100%"/>           
+    </mx:Panel>
+
+    <mx:RemoteObject id="remoteObject" 
+        destination="filteredFault"
+        result="resultHandler(event)"
+        fault="faultHandler(event)"/>
+                    
+    <mx:Script>
+        <![CDATA[
+        
+    	    import mx.rpc.events.FaultEvent;	                
+            import mx.rpc.events.ResultEvent;
+            
+			import mx.logging.Log;
+	        import mx.logging.targets.TraceTarget;			
+	        					
+    		private function creationCompleteHandler():void
+    		{
+                var target:TraceTarget = new TraceTarget();
+		        target.includeLevel = true;
+		        target.filters = ["mx.messaging.*", "mx.rpc.*"];
+		        Log.addTarget(target);            			
+    		}
+    		     		 
+            private function echo():void
+            {
+                var text:String = ti.text;
+                remoteObject.echo(text);
+            }
+                                                            
+            private function resultHandler(event:ResultEvent):void
+            {
+                ta.text += "Server responded: "+ event.result + "\n";  
+            }
+                       
+            private function faultHandler(event:FaultEvent):void
+            {
+                ta.text += "Received fault: " + event.fault + "\n";
+            }      
+            
+        ]]>
+    </mx:Script>
+
+</mx:Application>

http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/7a58369c/apps/team/features/remoting/remoting_AMF.mxml
----------------------------------------------------------------------
diff --git a/apps/team/features/remoting/remoting_AMF.mxml b/apps/team/features/remoting/remoting_AMF.mxml
new file mode 100755
index 0000000..f0d876f
--- /dev/null
+++ b/apps/team/features/remoting/remoting_AMF.mxml
@@ -0,0 +1,77 @@
+<?xml version="1.0"?>
+<!--
+
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+
+-->
+<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="100%"
+    creationComplete="creationCompleteHandler();">
+    
+    <!-- A simple remoting sample where client sends a text and server simply
+         echoes it back using an AMF channel.
+    -->
+    <mx:Panel id="mainPanel" height="100%" width="100%">
+        <mx:HBox>    
+        	<mx:Label text="Enter a text for the server to echo"/>        
+            <mx:TextInput id="ti" text="Hello World!"/>
+        	<mx:Button label="Send" click="echo()"/>
+            <mx:Button label="Clear" click='ta.text = ""'/>                	
+        </mx:HBox>        	
+        <mx:TextArea id="ta" width="100%" height="100%"/>           
+    </mx:Panel>
+
+    <mx:RemoteObject id="remoteObject" 
+        destination="remoting_AMF"
+        result="resultHandler(event)"
+        fault="faultHandler(event)"/>
+                    
+    <mx:Script>
+        <![CDATA[
+        
+    	    import mx.rpc.events.FaultEvent;	                
+            import mx.rpc.events.ResultEvent;
+            
+			import mx.logging.Log;
+	        import mx.logging.targets.TraceTarget;			
+	        					
+    		private function creationCompleteHandler():void
+    		{
+                var target:TraceTarget = new TraceTarget();
+		        target.includeLevel = true;
+		        target.filters = ["mx.messaging.*", "mx.rpc.*"];
+		        Log.addTarget(target);            			
+    		}
+    		     		 
+            private function echo():void
+            {
+                var text:String = ti.text;
+                remoteObject.echo(text);
+            }
+                                                            
+            private function resultHandler(event:ResultEvent):void
+            {
+                ta.text += "Server responded: "+ event.result + "\n";  
+            }
+                       
+            private function faultHandler(event:FaultEvent):void
+            {
+                ta.text += "Received fault: " + event.fault + "\n";
+            }      
+            
+        ]]>
+    </mx:Script>
+
+</mx:Application>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/7a58369c/apps/team/features/remoting/remoting_AMFX.mxml
----------------------------------------------------------------------
diff --git a/apps/team/features/remoting/remoting_AMFX.mxml b/apps/team/features/remoting/remoting_AMFX.mxml
new file mode 100755
index 0000000..0f2b7f0
--- /dev/null
+++ b/apps/team/features/remoting/remoting_AMFX.mxml
@@ -0,0 +1,77 @@
+<?xml version="1.0"?>
+<!--
+
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+
+-->
+<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="100%"
+    creationComplete="creationCompleteHandler();">
+    
+    <!-- A simple remoting sample where client sends a text and server simply
+         echoes it back using an AMF channel.
+    -->
+    <mx:Panel id="mainPanel" height="100%" width="100%">
+        <mx:HBox>    
+            <mx:Label text="Enter a text for the server to echo"/>        
+            <mx:TextInput id="ti" text="Hello World!"/>
+            <mx:Button label="Send" click="echo()"/>
+            <mx:Button label="Clear" click='ta.text = ""'/>                 
+        </mx:HBox>          
+        <mx:TextArea id="ta" width="100%" height="100%"/>           
+    </mx:Panel>
+
+    <mx:RemoteObject id="remoteObject" 
+        destination="remoting_AMFX"
+        result="resultHandler(event)"
+        fault="faultHandler(event)"/>
+                    
+    <mx:Script>
+        <![CDATA[
+        
+            import mx.rpc.events.FaultEvent;                    
+            import mx.rpc.events.ResultEvent;
+            
+            import mx.logging.Log;
+            import mx.logging.targets.TraceTarget;          
+                                
+            private function creationCompleteHandler():void
+            {
+                var target:TraceTarget = new TraceTarget();
+                target.includeLevel = true;
+                target.filters = ["mx.messaging.*", "mx.rpc.*"];
+                Log.addTarget(target);                      
+            }
+                         
+            private function echo():void
+            {
+                var text:String = ti.text;
+                remoteObject.echo(text);
+            }
+                                                            
+            private function resultHandler(event:ResultEvent):void
+            {
+                ta.text += "Server responded: "+ event.result + "\n";  
+            }
+                       
+            private function faultHandler(event:FaultEvent):void
+            {
+                ta.text += "Received fault: " + event.fault + "\n";
+            }      
+            
+        ]]>
+    </mx:Script>
+
+</mx:Application>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/7a58369c/apps/team/features/remoting/remoting_AMF_Dictionary.mxml
----------------------------------------------------------------------
diff --git a/apps/team/features/remoting/remoting_AMF_Dictionary.mxml b/apps/team/features/remoting/remoting_AMF_Dictionary.mxml
new file mode 100755
index 0000000..c7f9488
--- /dev/null
+++ b/apps/team/features/remoting/remoting_AMF_Dictionary.mxml
@@ -0,0 +1,104 @@
+<?xml version="1.0"?>
+<!--
+
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+
+-->
+<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="100%"
+    creationComplete="creationCompleteHandler();">
+
+    <!-- A remoting sample where client sends the new Dictionary type to the server
+         which in turn echoes the Dictionary back using AMF.
+    -->
+    <mx:Panel id="mainPanel" height="100%" width="100%">
+        <mx:HBox>
+            <mx:Button label="Echo Sparse Array" click="echoSparseArray()"/>
+            <mx:Button label="Echo Dense Array" click="echoDenseArray()"/>
+            <mx:Button label="Echo Map" click="echoMap()"/>
+            <mx:Button label="Echo Dictionary" click="echoDictionary()"/>
+            <mx:Button label="Clear" click='ta.text = ""'/>
+        </mx:HBox>
+        <mx:TextArea id="ta" width="100%" height="100%"/>
+    </mx:Panel>
+
+    <mx:RemoteObject id="remoteObject"
+        destination="remoting_AMF"
+        result="resultHandler(event)"
+        fault="faultHandler(event)"/>
+
+    <mx:Script>
+        <![CDATA[
+
+            import mx.rpc.events.FaultEvent;
+            import mx.rpc.events.ResultEvent;
+
+            import mx.logging.Log;
+            import mx.logging.targets.TraceTarget;
+
+            private function creationCompleteHandler():void
+            {
+                var target:TraceTarget = new TraceTarget();
+                target.includeLevel = true;
+                target.filters = ["mx.messaging.*", "mx.rpc.*"];
+                Log.addTarget(target);
+            }
+
+            private function echoDenseArray():void
+            {
+                var array:Array = [];
+                for (var i:int = 0; i < 5; i++)
+                    array[i] = "value" + i;
+                remoteObject.echoDenseArray(array);
+            }
+
+            private function echoSparseArray():void
+            {
+                var array:Array = [];
+                for (var i:int = 0; i < 5; i++)
+                    array["foo" + i] = "value" + i;
+                remoteObject.echoSparseArray(array);
+            }
+
+            private function echoMap():void
+            {
+                var map:Object = new Object();
+                for (var i:int = 0; i < 5; i++)
+                    map["key"+ i] = "value" + i;
+                remoteObject.echoMap(map);
+            }
+
+            private function echoDictionary():void
+            {
+                var dict:Dictionary = new Dictionary(true);
+                for (var i:int = 0; i < 5; i++)
+                    dict["key"+ i] = "value" + i;
+                remoteObject.echoDictionary(dict);
+            }
+
+            private function resultHandler(event:ResultEvent):void
+            {
+                ta.text += "Server responded: "+ event.result + "\n";
+            }
+
+            private function faultHandler(event:FaultEvent):void
+            {
+                ta.text += "Received fault: " + event.fault + "\n";
+            }
+
+        ]]>
+    </mx:Script>
+
+</mx:Application>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/7a58369c/apps/team/features/remoting/remoting_AMF_Legacy.mxml
----------------------------------------------------------------------
diff --git a/apps/team/features/remoting/remoting_AMF_Legacy.mxml b/apps/team/features/remoting/remoting_AMF_Legacy.mxml
new file mode 100755
index 0000000..be09cad
--- /dev/null
+++ b/apps/team/features/remoting/remoting_AMF_Legacy.mxml
@@ -0,0 +1,78 @@
+<?xml version="1.0"?>
+<!--
+
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+
+-->
+<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="100%"
+    creationComplete="creationCompleteHandler();">
+    <!--
+        This is an example of legacy way of making remote object calls with a 
+        NetConnection, rather than RemoteObject. 
+    -->
+    
+    <mx:Panel id="mainPanel" height="100%" width="100%">
+        <mx:HBox>    
+            <mx:Label text="Enter a text for the server to echo"/>
+            <mx:TextInput id="ti" text="Hello World!"/>
+            <mx:Button label="Send" click="echo()"/>
+            <mx:Button label="Clear" click='ta.text = ""'/>
+        </mx:HBox>
+        <mx:TextArea id="ta" width="100%" height="100%"/>
+    </mx:Panel>
+
+    <mx:Script>
+        <![CDATA[
+            import flash.net.NetConnection;
+            import flash.net.ObjectEncoding;
+            import flash.net.Responder;
+
+            private var nc:NetConnection
+            
+            private function creationCompleteHandler():void
+            {
+                nc = new NetConnection();
+                nc.client = this;
+                nc.objectEncoding = ObjectEncoding.AMF0;
+                nc.connect("http://localhost:8400/team/messagebroker/amf" );
+            }
+
+            private function echo():void
+            {
+                nc.call( "remoting_AMF.echo", new Responder( resultHandler, faultHandler ), ti.text );
+            }
+
+            private function resultHandler(result:Object):void
+            {
+                ta.text += "Server responded: "+ result + "\n";
+            }
+
+            private function faultHandler(fault:Object):void
+            {
+                ta.text += "Received fault: " + fault + "\n";
+            }
+
+            /**
+             * Called when AppendToGatewayUrl header is in the AMF message.
+             */
+            public function AppendToGatewayUrl(value:String):void
+            {
+                //No-op
+            }
+        ]]>
+    </mx:Script>
+
+</mx:Application>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/7a58369c/apps/team/features/remoting/remoting_AMF_ReadOnly.mxml
----------------------------------------------------------------------
diff --git a/apps/team/features/remoting/remoting_AMF_ReadOnly.mxml b/apps/team/features/remoting/remoting_AMF_ReadOnly.mxml
new file mode 100755
index 0000000..b9aa571
--- /dev/null
+++ b/apps/team/features/remoting/remoting_AMF_ReadOnly.mxml
@@ -0,0 +1,69 @@
+<?xml version="1.0"?>
+<!--
+
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+
+-->
+<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="100%"
+    creationComplete="creationCompleteHandler();">
+    
+    <!-- A simple remoting sample where the client receives a read-only object
+         from the server.
+    -->
+    <mx:Panel id="mainPanel" height="100%" width="100%">
+        <mx:HBox>
+        	<mx:Button label="Echo read-only" click="remoteObject.echoReadOnly()"/>
+            <mx:Button label="Clear" click='ta.text = ""'/>
+        </mx:HBox>        	
+        <mx:TextArea id="ta" width="100%" height="100%"/>
+    </mx:Panel>
+
+    <mx:RemoteObject id="remoteObject" 
+        destination="remoting_AMF"
+        result="resultHandler(event)"
+        fault="faultHandler(event)"/>
+
+    <mx:Script>
+        <![CDATA[
+        
+            import mx.rpc.events.FaultEvent;
+            import mx.rpc.events.ResultEvent;
+
+            import mx.logging.Log;
+            import mx.logging.targets.TraceTarget;
+
+            private function creationCompleteHandler():void
+            {
+                var target:TraceTarget = new TraceTarget();
+                target.includeLevel = true;
+                target.filters = ["mx.messaging.*", "mx.rpc.*"];
+                Log.addTarget(target);
+            }
+
+            private function resultHandler(event:ResultEvent):void
+            {
+                ta.text += "Server responded: "+ event.result.property + "\n";
+            }
+
+            private function faultHandler(event:FaultEvent):void
+            {
+                ta.text += "Received fault: " + event.fault + "\n";
+            }
+
+        ]]>
+    </mx:Script>
+
+</mx:Application>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/7a58369c/apps/team/features/remoting/remoting_AMF_Vector.mxml
----------------------------------------------------------------------
diff --git a/apps/team/features/remoting/remoting_AMF_Vector.mxml b/apps/team/features/remoting/remoting_AMF_Vector.mxml
new file mode 100755
index 0000000..b4c6d69
--- /dev/null
+++ b/apps/team/features/remoting/remoting_AMF_Vector.mxml
@@ -0,0 +1,122 @@
+<?xml version="1.0"?>
+<!--
+
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+
+-->
+<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="100%"
+    creationComplete="creationCompleteHandler();">
+
+    <!-- A remoting sample where client sends the new Vector type to the server
+         which in turn echoes the Vector back using AMF. Make sure you enable the
+         prefer-vectors flag in the channel configuration.
+    -->
+    <mx:Panel id="mainPanel" height="100%" width="100%">
+        <mx:HBox>
+            <mx:Button label="Echo Int Vector" click="echoIntVector()"/>
+            <mx:Button label="Echo UInt Vector" click="echoUIntVector()"/>
+            <mx:Button label="Echo Double Vector" click="echoDoubleVector()"/>
+            <mx:Button label="Echo Object Vector" click="echoObjectVector()"/>
+            <mx:Button label="Echo String Vector" click="echoStringVector()"/>
+            <mx:Button label="Clear" click='ta.text = ""'/>
+        </mx:HBox>
+        <mx:HBox>
+            <mx:Button label="Echo Fixed Int Vector" click="echoIntVector(true)"/>
+            <mx:Button label="Echo Fixed UInt Vector" click="echoUIntVector(true)"/>
+            <mx:Button label="Echo Fixed Double Vector" click="echoDoubleVector(true)"/>
+            <mx:Button label="Echo Fixed Object Vector" click="echoObjectVector(true)"/>
+            <mx:Button label="Echo Fixed String Vector" click="echoStringVector(true)"/>
+            <mx:Button label="Clear" click='ta.text = ""'/>
+        </mx:HBox>
+        <mx:TextArea id="ta" width="100%" height="100%"/>
+    </mx:Panel>
+
+    <mx:RemoteObject id="remoteObject"
+        destination="remoting_AMF"
+        result="resultHandler(event)"
+        fault="faultHandler(event)"/>
+
+    <mx:Script>
+        <![CDATA[
+
+            import mx.rpc.events.FaultEvent;
+            import mx.rpc.events.ResultEvent;
+
+            import mx.logging.Log;
+            import mx.logging.targets.TraceTarget;
+
+            private function creationCompleteHandler():void
+            {
+                var target:TraceTarget = new TraceTarget();
+                target.includeLevel = true;
+                target.filters = ["mx.messaging.*", "mx.rpc.*"];
+                Log.addTarget(target);
+            }
+
+            private function echoIntVector(fixed:Boolean=false):void
+            {
+                var vector:Vector.<int> = new Vector.<int>(5, fixed);
+                for (var i:int = 0; i < 5; i++)
+                    vector[i] = i;
+                remoteObject.echoIntVector(vector);
+            }
+
+            private function echoUIntVector(fixed:Boolean=false):void
+            {
+                var vector:Vector.<uint> = new Vector.<uint>(5, fixed);
+                for (var i:uint = 0; i < 5; i++)
+                    vector[i] = uint.MAX_VALUE;
+                remoteObject.echoUIntVector(vector);
+            }
+
+            private function echoDoubleVector(fixed:Boolean=false):void
+            {
+                var vector:Vector.<Number> = new Vector.<Number>(5, fixed);
+                for (var i:int = 0; i < 5; i++)
+                    vector[i] = Number(i);
+                remoteObject.echoDoubleVector(vector);
+            }
+
+            private function echoObjectVector(fixed:Boolean=false):void
+            {
+                var vector:Vector.<Object> = new Vector.<Object>(5, fixed);
+                for (var i:int = 0; i < 5; i++)
+                    vector[i] = "value" + i;
+                remoteObject.echoObjectVector(vector);
+            }
+
+            private function echoStringVector(fixed:Boolean=false):void
+            {
+                var vector:Vector.<String> = new Vector.<String>(5, fixed);
+                for (var i:int = 0; i < 5; i++)
+                    vector[i] = "value" + i;
+                remoteObject.echoStringVector(vector);
+            }
+
+            private function resultHandler(event:ResultEvent):void
+            {
+                ta.text += "Server responded: "+ event.result + "\n";
+            }
+
+            private function faultHandler(event:FaultEvent):void
+            {
+                ta.text += "Received fault: " + event.fault + "\n";
+            }
+
+        ]]>
+    </mx:Script>
+
+</mx:Application>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/7a58369c/apps/team/features/runtimeconfig/runtimeconfig_MessageDestination.mxml
----------------------------------------------------------------------
diff --git a/apps/team/features/runtimeconfig/runtimeconfig_MessageDestination.mxml b/apps/team/features/runtimeconfig/runtimeconfig_MessageDestination.mxml
new file mode 100755
index 0000000..7ea1683
--- /dev/null
+++ b/apps/team/features/runtimeconfig/runtimeconfig_MessageDestination.mxml
@@ -0,0 +1,150 @@
+<?xml version="1.0"?>
+<!--
+
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+
+-->
+<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="100%"
+    creationComplete="creationCompleteHandler();">
+
+    <!-- This sample calls a remote object to dynamically create a message 
+         destination and tries to use that destination.
+    -->
+    <mx:Panel id="mainPanel" height="100%" width="100%">
+        <mx:HBox>
+            <mx:Button label="Create Destination" click="createDestination();" 
+                enabled="{!destinationCreated}"/>
+            <mx:Button label="Remove Destination" click="removeDestination();" 
+                enabled="{destinationCreated}"/> 
+        </mx:HBox>
+        <mx:HBox enabled="{destinationCreated}">
+            <mx:Label text="Producer"/>
+            <mx:Button label="Send Foo" click="sendMessage()"/>
+            <mx:Button label="Disconnect" click="producer.disconnect();" enabled="{producer.connected}"/>
+            <mx:CheckBox label="Connected?" selected="{producer.connected}"/>
+        </mx:HBox>
+        <mx:HBox enabled="{destinationCreated}">
+            <mx:Label text="Consumer"/>
+            <mx:Button label="Subcribe" click="consumer.subscribe();" enabled="{!consumer.subscribed}"/>
+            <mx:Button label="Unsubscribe" click="consumer.unsubscribe();" enabled="{consumer.subscribed}"/>
+            <mx:Button label="Disconnect" click="consumer.disconnect();" enabled="{consumer.connected}"/>
+            <mx:CheckBox label="Connected?" selected="{consumer.connected}"/>
+            <mx:CheckBox label="Subscribed?" selected="{consumer.subscribed}"/>
+        </mx:HBox>
+        <mx:Button label="Clear" click='ta.text = ""'/>
+        <mx:TextArea id="ta" width="100%" height="100%"/>
+    </mx:Panel>
+
+    <mx:RemoteObject id="runtimeConfigurator" 
+        destination="RuntimeConfigurator"/>
+
+    <mx:Producer id="producer" 
+        destination="messaging_AMF_Poll_Runtime"
+        fault="messageFaultHandler(event)"/>
+
+    <mx:Consumer id="consumer" 
+        destination="messaging_AMF_Poll_Runtime"
+        fault="messageFaultHandler(event)" 
+        message="messageHandler(event)"/>
+
+    <mx:Script>
+        <![CDATA[
+            import mx.messaging.ChannelSet;
+            import mx.messaging.channels.AMFChannel;
+            import mx.messaging.events.MessageFaultEvent;
+            import mx.messaging.events.MessageEvent;
+            import mx.messaging.messages.AsyncMessage;
+            import mx.messaging.Producer;
+            import mx.messaging.Consumer;
+
+            import mx.rpc.AsyncToken;
+            import mx.rpc.AsyncResponder;
+            import mx.rpc.events.FaultEvent;
+            import mx.rpc.events.ResultEvent;
+
+            import mx.logging.Log;
+            import mx.logging.targets.TraceTarget;
+
+            [Bindable]
+            public var destinationCreated:Boolean = false;
+
+            private function creationCompleteHandler():void
+            {
+                var target:TraceTarget = new TraceTarget();
+                target.includeLevel = true;
+                target.filters = ["mx.messaging.*", "mx.rpc.*"];
+                Log.addTarget(target);  
+
+                // Need to set the ChannelSet for dynamically created destinations. 
+                // This channel should match with whatever channel the destination uses.
+                var channelSet:ChannelSet = new ChannelSet();
+                var channel:AMFChannel = new AMFChannel("my-amf-poll", "http://localhost:8400/team/messagebroker/myamfpoll");
+                channelSet.addChannel(channel);
+                producer.channelSet = channelSet;
+                consumer.channelSet = channelSet;
+            }
+
+            private function createDestination():void
+            {
+                var token:AsyncToken = runtimeConfigurator.createMessageDestination();
+                token.addResponder(new AsyncResponder(
+                    function (event:ResultEvent, token:Object=null):void
+                    {
+                        ta.text += "RuntimeConfigurator result: "+ event.result + "\n";
+                        destinationCreated = true;
+                    },
+                    function (event:FaultEvent, token:Object=null):void
+                    {
+                        ta.text += "RuntimeConfigurator fault: " + event.fault + "\n";
+                        destinationCreated = false;
+                    })); 
+            }
+
+            private function removeDestination():void
+            {
+                var token:AsyncToken = runtimeConfigurator.removeMessageDestination();
+                token.addResponder(new AsyncResponder(
+                    function (event:ResultEvent, token:Object=null):void
+                    {
+                        ta.text += "RuntimeConfigurator result: "+ event.result + "\n";
+                        destinationCreated = false;
+                    },
+                    function (event:FaultEvent, token:Object=null):void
+                    {
+                        ta.text += "RuntimeConfigurator fault: " + event.fault + "\n";
+                        destinationCreated = false;
+                    }));
+            }
+
+            private function sendMessage():void
+            {
+                var msg:AsyncMessage = new AsyncMessage();
+                msg.body = "Foo";
+                producer.send(msg);
+            }
+
+            private function messageHandler(event:MessageEvent):void
+            {
+                ta.text += "Consumer received message: "+ event.message.body + "\n";
+            }
+
+            private function messageFaultHandler(event:MessageFaultEvent):void
+            {
+                ta.text += "Received fault: " + event.faultString + "\n";
+            }
+        ]]>
+    </mx:Script>
+</mx:Application>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/7a58369c/apps/team/features/runtimeconfig/runtimeconfig_MessageDestinationWithJMS.mxml
----------------------------------------------------------------------
diff --git a/apps/team/features/runtimeconfig/runtimeconfig_MessageDestinationWithJMS.mxml b/apps/team/features/runtimeconfig/runtimeconfig_MessageDestinationWithJMS.mxml
new file mode 100755
index 0000000..4aa0167
--- /dev/null
+++ b/apps/team/features/runtimeconfig/runtimeconfig_MessageDestinationWithJMS.mxml
@@ -0,0 +1,131 @@
+<?xml version="1.0"?>
+<!--
+
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+
+-->
+<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="100%"
+    creationComplete="creationCompleteHandler();">
+
+    <!-- This sample calls a remote object to dynamically create a message 
+         destination that uses JMSAdapter and tries to use that destination.
+    -->
+    <mx:Panel id="mainPanel" height="100%" width="100%">
+        <mx:HBox>
+            <mx:Button label="Create Destination" click="createDestination();"/> 
+        </mx:HBox>
+        <mx:HBox enabled="{destinationCreated}">
+            <mx:Label text="Producer"/>
+            <mx:Button label="Send Foo" click="sendMessage()"/>
+            <mx:Button label="Disconnect" click="producer.disconnect();" enabled="{producer.connected}"/>
+            <mx:CheckBox label="Connected?" selected="{producer.connected}"/>
+        </mx:HBox>
+        <mx:HBox enabled="{destinationCreated}">
+            <mx:Label text="Consumer"/>
+            <mx:Button label="Subcribe" click="consumer.subscribe();" enabled="{!consumer.subscribed}"/>
+            <mx:Button label="Unsubscribe" click="consumer.unsubscribe();" enabled="{consumer.subscribed}"/>
+            <mx:Button label="Disconnect" click="consumer.disconnect();" enabled="{consumer.connected}"/>
+            <mx:CheckBox label="Connected?" selected="{consumer.connected}"/>
+            <mx:CheckBox label="Subscribed?" selected="{consumer.subscribed}"/>
+        </mx:HBox>
+        <mx:Button label="Clear" click='ta.text = ""'/>
+        <mx:TextArea id="ta" width="100%" height="100%"/>
+    </mx:Panel>
+
+    <mx:RemoteObject id="runtimeConfigurator" 
+        destination="RuntimeConfigurator"
+        result="resultHandler(event)"
+        fault="faultHandler(event)"/>
+
+    <mx:Producer id="producer" 
+        destination="messaging_AMF_Poll_JMS_Topic_Runtime"
+        fault="messageFaultHandler(event)"/>
+
+    <mx:Consumer id="consumer" 
+        destination="messaging_AMF_Poll_JMS_Topic_Runtime"
+        fault="messageFaultHandler(event)" 
+        message="messageHandler(event)"/>
+
+    <mx:Script>
+        <![CDATA[
+            import mx.messaging.ChannelSet;
+            import mx.messaging.channels.AMFChannel;
+            import mx.messaging.events.MessageFaultEvent;
+            import mx.messaging.events.MessageEvent;
+            import mx.messaging.messages.AsyncMessage;
+            import mx.messaging.Producer;
+            import mx.messaging.Consumer;
+
+            import mx.rpc.events.FaultEvent;
+            import mx.rpc.events.ResultEvent;
+
+            import mx.logging.Log;
+            import mx.logging.targets.TraceTarget;
+
+            [Bindable]
+            public var destinationCreated:Boolean = false;
+
+            private function creationCompleteHandler():void
+            {
+                var target:TraceTarget = new TraceTarget();
+                target.includeLevel = true;
+                target.filters = ["mx.messaging.*", "mx.rpc.*"];
+                Log.addTarget(target);  
+
+                // Need to set the ChannelSet for dynamically created destinations. 
+                // This channel should match with whatever channel the destination uses.
+                var channelSet:ChannelSet = new ChannelSet();
+                var channel:AMFChannel = new AMFChannel("my-amf-poll", "http://localhost:8400/team/messagebroker/myamfpoll");
+                channelSet.addChannel(channel);
+                producer.channelSet = channelSet;
+                consumer.channelSet = channelSet;
+            }
+
+            private function createDestination():void
+            {
+                runtimeConfigurator.createMessageDestinationWithJMSAdapter();
+            }
+
+            private function resultHandler(event:ResultEvent):void
+            {
+                ta.text += "RuntimeConfigurator result: "+ event.result + "\n";
+                destinationCreated = true;
+            }
+
+            private function faultHandler(event:FaultEvent):void
+            {
+                ta.text += "RuntimeConfigurator fault: " + event.fault + "\n";
+            }
+
+            private function sendMessage():void
+            {
+                var msg:AsyncMessage = new AsyncMessage();
+                msg.body = "Foo";
+                producer.send(msg);
+            }
+
+            private function messageHandler(event:MessageEvent):void
+            {
+                ta.text += "Consumer received message: "+ event.message.body + "\n";
+            }
+
+            private function messageFaultHandler(event:MessageFaultEvent):void
+            {
+                ta.text += "Received fault: " + event.faultString + "\n";
+            }
+        ]]>
+    </mx:Script>
+</mx:Application>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/7a58369c/apps/team/features/security-constraints/README.txt
----------------------------------------------------------------------
diff --git a/apps/team/features/security-constraints/README.txt b/apps/team/features/security-constraints/README.txt
new file mode 100755
index 0000000..3f7a722
--- /dev/null
+++ b/apps/team/features/security-constraints/README.txt
@@ -0,0 +1,6 @@
+This is an overview of how to secure BlazeDS destinations:
+
+1- In services-config.xml, under security section, uncomment a login command for your application server. 
+2- In services-config.xml, under security section, define a security constraint that your destinatios will refer to. A security constraint can be basic or custom and it can have one or more roles. Basic authentication means a browser window pops up asking the user for username and password when the client tries to access the destination. Custom authentication means instead of a browser window, the Flex application itself passes the authentication to BlazeDS. Roles are application server specific. For example, in Tomcat, they are defined in conf/tomcat-user.xml file.
+3- In your destination definition, refer to the security constraint you defined in the previous step with "<security-constraint ref=""/>" tag.
+4- If your destinations are using basic authentication, then no extra work is required in your Flex application. If they are using custom authentication, then you need to pass the credentials to BlazeDS, preferably using ChannelSet.login method and listening for authentication success or failure with AsyncToken pattern.
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/7a58369c/apps/team/features/security-constraints/securityConstraint_Basic.mxml
----------------------------------------------------------------------
diff --git a/apps/team/features/security-constraints/securityConstraint_Basic.mxml b/apps/team/features/security-constraints/securityConstraint_Basic.mxml
new file mode 100755
index 0000000..f9ecde9
--- /dev/null
+++ b/apps/team/features/security-constraints/securityConstraint_Basic.mxml
@@ -0,0 +1,71 @@
+<?xml version="1.0"?>
+<!--
+
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+
+-->
+<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="100%"
+    creationComplete="creationCompleteHandler();">
+
+    <!-- A simple remoting sample where client sends a text and server simply
+         echoes it back. The destination is secured using basic security constraint
+         where a browser window pops up for username and password.
+    -->
+    <mx:Panel id="mainPanel" height="100%" width="100%">
+        <mx:HBox>
+            <mx:Label text="Enter a text for the server to echo"/>
+            <mx:TextInput id="ti" text="Hello World!"/>
+            <mx:Button label="Send" click="remoteObject.echo(ti.text);"/>
+        </mx:HBox>
+        <mx:TextArea id="ta" width="100%" height="100%"/>
+    </mx:Panel>
+
+    <mx:RemoteObject id="remoteObject"
+        destination="remoting_AMF_SecurityConstraint_Basic"
+        result="resultHandler(event)"
+        fault="faultHandler(event)"/>
+
+    <mx:Script>
+        <![CDATA[
+
+            import mx.rpc.events.FaultEvent;
+            import mx.rpc.events.ResultEvent;
+
+            import mx.logging.Log;
+            import mx.logging.targets.TraceTarget;
+
+            private function creationCompleteHandler():void
+            {
+                var target:TraceTarget = new TraceTarget();
+                target.includeLevel = true;
+                target.filters = ["mx.messaging.*", "mx.rpc.*"];
+                Log.addTarget(target);
+            }
+
+            private function resultHandler(event:ResultEvent):void
+            {
+                ta.text += "Server responded: "+ event.result + "\n";
+            }
+
+            private function faultHandler(event:FaultEvent):void
+            {
+                ta.text += "Received fault: " + event.fault + "\n";
+            }
+
+        ]]>
+    </mx:Script>
+
+</mx:Application>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/7a58369c/apps/team/features/security-constraints/securityConstraint_Custom.mxml
----------------------------------------------------------------------
diff --git a/apps/team/features/security-constraints/securityConstraint_Custom.mxml b/apps/team/features/security-constraints/securityConstraint_Custom.mxml
new file mode 100755
index 0000000..de90fef
--- /dev/null
+++ b/apps/team/features/security-constraints/securityConstraint_Custom.mxml
@@ -0,0 +1,140 @@
+<?xml version="1.0"?>
+<!--
+
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+
+-->
+<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="100%"
+    creationComplete="creationCompleteHandler();">
+
+    <!-- A simple remoting sample where client sends a text and server simply
+         echoes it back. The destination is secured using custom security constraint
+         where instead of a browser window for username and password, application 
+         itself handles authentication.
+    -->
+    <mx:Panel id="mainPanel" height="100%" width="100%">
+        <mx:HBox>
+            <mx:Label text="Username"/>
+            <mx:TextInput id="unameTI" text="sampleuser"/>
+            <mx:Label text="Password"/>
+            <mx:TextInput id="passTI" text="samplepassword"/>
+            <mx:Button label="Login" click="login(unameTI.text, passTI.text)"/>
+            <mx:Button label="Logout" click="logout()"/>
+            <mx:CheckBox id="authenticatedCB" label="Authenticated?"/>
+        </mx:HBox>
+        <mx:HBox>
+            <mx:Label text="Enter a text for the server to echo"/>
+            <mx:TextInput id="ti" text="Hello World!"/>
+            <mx:Button label="Echo" click="remoteObject.echo(ti.text);" enabled="{authenticatedCB.selected}"/>
+        </mx:HBox>
+        <mx:TextArea id="ta" width="100%" height="100%"/>
+    </mx:Panel>
+
+    <mx:RemoteObject id="remoteObject"
+        destination="remoting_AMF_SecurityConstraint_Custom"
+        result="resultHandler(event)"
+        fault="faultHandler(event)"/>
+
+    <mx:Script>
+        <![CDATA[
+            import mx.binding.utils.BindingUtils;
+            import mx.controls.Alert;
+            import mx.logging.Log;
+            import mx.logging.targets.TraceTarget;
+            import mx.messaging.config.ServerConfig;
+            import mx.rpc.AsyncResponder;
+            import mx.rpc.AsyncToken;
+            import mx.rpc.events.FaultEvent;
+            import mx.rpc.events.ResultEvent;
+
+            private function creationCompleteHandler():void
+            {
+                var target:TraceTarget = new TraceTarget();
+                target.includeLevel = true;
+                target.filters = ["mx.messaging.*", "mx.rpc.*"];
+                Log.addTarget(target);
+                
+                // Pre-initialize channelSet, so we can login and bind to authenticatedCB.
+                if (remoteObject.channelSet == null)
+                {
+                    remoteObject.channelSet = ServerConfig.getChannelSet(remoteObject.destination);
+                    BindingUtils.bindProperty(authenticatedCB, "selected", remoteObject.channelSet, "authenticated");
+                }
+            }
+
+            private function login(username:String, password:String):void
+            {
+                // Login and handle success or failure of authentication 
+                var token:AsyncToken = remoteObject.channelSet.login(username, password);
+                token.addResponder(new AsyncResponder(
+                    function(event:ResultEvent, token:Object=null):void 
+                    {
+                        switch(event.result) 
+                        {
+                            case "success":
+                                trace("authentication success");
+                            break;
+                            default:
+                                trace(event.result); 
+                        }
+                    },
+                    function(event:FaultEvent, token:Object=null):void
+                    {
+                        switch(event.fault.faultCode)
+                        {
+                            case "Client.Authentication":
+                            default:
+                                Alert.show("Login failure: " + event.fault.faultString);
+                        }
+                    }));
+            }
+
+            private function logout():void
+            {
+                // Logout and handle success or failure of authentication 
+                var token:AsyncToken = remoteObject.channelSet.logout();
+                token.addResponder(new AsyncResponder(
+                    function(event:ResultEvent, token:Object=null):void 
+                    {
+                        switch (event.result) 
+                        {
+                            case "success":
+                                authenticatedCB.selected = false;
+                            break;
+                            default:
+                                trace(event.result); 
+                        }
+                    },
+                    function(event:FaultEvent, token:Object=null):void
+                    {
+                        trace(event.fault);
+                    }));
+            }
+
+            private function resultHandler(event:ResultEvent):void
+            {
+                ta.text += "Server responded: "+ event.result + "\n";
+            }
+
+            private function faultHandler(event:FaultEvent):void
+            {
+                ta.text += "Received fault: " + event.fault + "\n";
+            }
+
+        ]]>
+    </mx:Script>
+
+</mx:Application>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/7a58369c/apps/team/features/security-constraints/securityConstraint_Legacy.mxml
----------------------------------------------------------------------
diff --git a/apps/team/features/security-constraints/securityConstraint_Legacy.mxml b/apps/team/features/security-constraints/securityConstraint_Legacy.mxml
new file mode 100755
index 0000000..501c44c
--- /dev/null
+++ b/apps/team/features/security-constraints/securityConstraint_Legacy.mxml
@@ -0,0 +1,104 @@
+<?xml version="1.0"?>
+<!--
+
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+
+-->
+<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="100%"
+    creationComplete="creationCompleteHandler();">
+
+    <!-- A simple remoting sample where client sends a text and server simply
+         echoes it back. The destination is secured using custom security constraint
+         where instead of a browser window for username and password, application 
+         itself handles authentication. 
+         
+         Note that this sample uses legacy authentication where RemoteObject#setCredentials 
+         are used instead of ChannelSet#login. This is not recommended.
+    -->
+    <mx:Panel id="mainPanel" height="100%" width="100%">
+        <mx:HBox>
+            <mx:Label text="Username"/>
+            <mx:TextInput id="unameTI" text="sampleuser"/>
+            <mx:Label text="Password"/>
+            <mx:TextInput id="passTI" text="samplepassword"/>
+            <mx:Button label="SetCredentials" click="setCredentials(unameTI.text, passTI.text)"/>
+            <mx:Button label="Logout" click="logout()"/>
+            <mx:CheckBox id="authenticatedCB" label="Authenticated?"/>
+        </mx:HBox>
+        <mx:HBox>
+            <mx:Label text="Enter a text for the server to echo"/>
+            <mx:TextInput id="ti" text="Hello World!"/>
+            <mx:Button label="Echo" click="remoteObject.echo(ti.text);"/>
+        </mx:HBox>
+        <mx:TextArea id="ta" width="100%" height="100%"/>
+    </mx:Panel>
+
+    <mx:RemoteObject id="remoteObject"
+        destination="remoting_AMF_SecurityConstraint_Custom"
+        result="resultHandler(event)"
+        fault="faultHandler(event)"/>
+
+    <mx:Script>
+        <![CDATA[
+            import mx.binding.utils.BindingUtils;
+            import mx.controls.Alert;
+            import mx.logging.Log;
+            import mx.logging.targets.TraceTarget;
+            import mx.messaging.config.ServerConfig;
+            import mx.rpc.AsyncResponder;
+            import mx.rpc.AsyncToken;
+            import mx.rpc.events.FaultEvent;
+            import mx.rpc.events.ResultEvent;
+
+            private function creationCompleteHandler():void
+            {
+                var target:TraceTarget = new TraceTarget();
+                target.includeLevel = true;
+                target.filters = ["mx.messaging.*", "mx.rpc.*"];
+                Log.addTarget(target);
+
+                // Pre-initialize channelSet, so we can bind to authenticatedCB.
+                if (remoteObject.channelSet == null)
+                {
+                    remoteObject.channelSet = ServerConfig.getChannelSet(remoteObject.destination);
+                    BindingUtils.bindProperty(authenticatedCB, "selected", remoteObject.channelSet, "authenticated");
+                }
+            }
+
+            private function setCredentials(username:String, password:String):void
+            {
+                remoteObject.setCredentials(username, password);
+            }
+
+            private function logout():void
+            {
+                remoteObject.logout();
+            }
+
+            private function resultHandler(event:ResultEvent):void
+            {
+                ta.text += "Server responded: "+ event.result + "\n";
+            }
+
+            private function faultHandler(event:FaultEvent):void
+            {
+                ta.text += "Received fault: " + event.fault + "\n";
+            }
+
+        ]]>
+    </mx:Script>
+
+</mx:Application>
\ No newline at end of file