This is an automated email from the ASF dual-hosted git repository. joshtynjala pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/flex-blazeds.git
commit c74d8a94043f9a05cbfcac771abb7ef9f34fde89 Author: Josh Tynjala <joshtynj...@apache.org> AuthorDate: Mon Aug 21 13:50:11 2023 -0700 typed-object: new sample --- distribution/pom.xml | 6 ++ distribution/src/assembly/assemble-bin.xml | 7 ++ samples/pom.xml | 1 + samples/typed-object/backend/pom.xml | 95 +++++++++++++++++ .../flex/blazeds/samples/typed/TypedObject.java | 59 +++++++++++ .../blazeds/samples/typed/TypedObjectService.java | 33 ++++++ .../main/webapp/WEB-INF/flex/services-config.xml | 102 ++++++++++++++++++ .../backend/src/main/webapp/WEB-INF/web.xml | 48 +++++++++ samples/typed-object/frontend/asconfig.json | 19 ++++ samples/typed-object/frontend/pom.xml | 117 +++++++++++++++++++++ .../src/main/resources/index-template.html} | 38 +++---- .../frontend/src/main/royale/Main.mxml | 112 ++++++++++++++++++++ .../flex/blazeds/samples/typed/TypedObject.as | 29 +++++ samples/{ => typed-object}/pom.xml | 14 +-- 14 files changed, 649 insertions(+), 31 deletions(-) diff --git a/distribution/pom.xml b/distribution/pom.xml index 0b7a455..7243235 100644 --- a/distribution/pom.xml +++ b/distribution/pom.xml @@ -99,5 +99,11 @@ <version>${project.version}</version> <type>war</type> </dependency> + <dependency> + <groupId>org.apache.flex.blazeds.samples.typed-object</groupId> + <artifactId>blazeds-typed-object-backend</artifactId> + <version>${project.version}</version> + <type>war</type> + </dependency> </dependencies> </project> \ No newline at end of file diff --git a/distribution/src/assembly/assemble-bin.xml b/distribution/src/assembly/assemble-bin.xml index 5ca8f85..55dd406 100644 --- a/distribution/src/assembly/assemble-bin.xml +++ b/distribution/src/assembly/assemble-bin.xml @@ -94,5 +94,12 @@ <include>org.apache.flex.blazeds.samples.hello:blazeds-hello-world-backend</include> </includes> </dependencySet> + <dependencySet> + <outputDirectory>/webapps</outputDirectory> + <outputFileNameMapping>typed-object.war</outputFileNameMapping> + <includes> + <include>org.apache.flex.blazeds.samples.typed-object:blazeds-typed-object-backend</include> + </includes> + </dependencySet> </dependencySets> </assembly> \ No newline at end of file diff --git a/samples/pom.xml b/samples/pom.xml index 235ac21..d47aa64 100644 --- a/samples/pom.xml +++ b/samples/pom.xml @@ -35,6 +35,7 @@ <modules> <module>hello-world</module> + <module>typed-object</module> <module>classic-turnkey-samples</module> </modules> </project> diff --git a/samples/typed-object/backend/pom.xml b/samples/typed-object/backend/pom.xml new file mode 100644 index 0000000..d495fb1 --- /dev/null +++ b/samples/typed-object/backend/pom.xml @@ -0,0 +1,95 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + 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. + +--><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.flex.blazeds.samples.typed-object</groupId> + <artifactId>blazeds-typed-object-sample</artifactId> + <version>4.9.0-SNAPSHOT</version> + </parent> + + <groupId>org.apache.flex.blazeds.samples.typed-object</groupId> + <artifactId>blazeds-typed-object-backend</artifactId> + <version>4.9.0-SNAPSHOT</version> + <packaging>war</packaging> + + <name>Apache Flex BlazeDS: Typed Object Sample: Backend</name> + + <properties> + <java.version>1.8</java.version> + </properties> + + <build> + <sourceDirectory>src/main/java</sourceDirectory> + <finalName>typed-object</finalName> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.5.1</version> + <configuration> + <source>${java.version}</source> + <target>${java.version}</target> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-war-plugin</artifactId> + <configuration> + <overlays> + <overlay> + <groupId>org.apache.flex.blazeds.samples.typed-object</groupId> + <artifactId>blazeds-typed-object-frontend</artifactId> + </overlay> + </overlays> + </configuration> + </plugin> + </plugins> + </build> + + <dependencies> + <dependency> + <groupId>org.apache.flex.blazeds</groupId> + <artifactId>flex-messaging-common</artifactId> + <version>4.9.0-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>org.apache.flex.blazeds</groupId> + <artifactId>flex-messaging-core</artifactId> + <version>4.9.0-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>org.apache.flex.blazeds</groupId> + <artifactId>flex-messaging-proxy</artifactId> + <version>4.9.0-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>org.apache.flex.blazeds</groupId> + <artifactId>flex-messaging-remoting</artifactId> + <version>4.9.0-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>org.apache.flex.blazeds.samples.typed-object</groupId> + <artifactId>blazeds-typed-object-frontend</artifactId> + <version>4.9.0-SNAPSHOT</version> + <type>war</type> + </dependency> + </dependencies> +</project> diff --git a/samples/typed-object/backend/src/main/java/org/apache/flex/blazeds/samples/typed/TypedObject.java b/samples/typed-object/backend/src/main/java/org/apache/flex/blazeds/samples/typed/TypedObject.java new file mode 100644 index 0000000..90f1d24 --- /dev/null +++ b/samples/typed-object/backend/src/main/java/org/apache/flex/blazeds/samples/typed/TypedObject.java @@ -0,0 +1,59 @@ +/* + * 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 org.apache.flex.blazeds.samples.typed; + +import java.io.Serializable; + +public class TypedObject implements Serializable { + + static final long serialVersionUID = 1L; + + private String str; + private boolean bool; + private double num; + + public TypedObject() { + + } + + public TypedObject(String str, boolean bool, double num) { + this.str = str; + this.bool = bool; + this.num = num; + } + + public String getString() { + return str; + } + public void setString(String str) { + this.str = str; + } + + public boolean getBoolean() { + return bool; + } + public void setBoolean(boolean bool) { + this.bool = bool; + } + + public double getNumber() { + return num; + } + public void setNumber(double num) { + this.num = num; + } +} diff --git a/samples/typed-object/backend/src/main/java/org/apache/flex/blazeds/samples/typed/TypedObjectService.java b/samples/typed-object/backend/src/main/java/org/apache/flex/blazeds/samples/typed/TypedObjectService.java new file mode 100644 index 0000000..5dd8c2c --- /dev/null +++ b/samples/typed-object/backend/src/main/java/org/apache/flex/blazeds/samples/typed/TypedObjectService.java @@ -0,0 +1,33 @@ +/* + * 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 org.apache.flex.blazeds.samples.typed; + +public class TypedObjectService { + private static TypedObject typedObject; + + public TypedObject getTypedObject() { + if (typedObject == null) { + typedObject = new TypedObject("", false, 0); + } + return typedObject; + } + + public void setTypedObject(TypedObject obj) { + typedObject = obj; + } + +} \ No newline at end of file diff --git a/samples/typed-object/backend/src/main/webapp/WEB-INF/flex/services-config.xml b/samples/typed-object/backend/src/main/webapp/WEB-INF/flex/services-config.xml new file mode 100755 index 0000000..11de281 --- /dev/null +++ b/samples/typed-object/backend/src/main/webapp/WEB-INF/flex/services-config.xml @@ -0,0 +1,102 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + 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. + +--> +<services-config> + <services> + <service id="remoting-service" class="flex.messaging.services.RemotingService"> + <adapters> + <adapter-definition id="java-object" class="flex.messaging.services.remoting.adapters.JavaAdapter" default="true"/> + </adapters> + + <default-channels> + <channel ref="my-amf"/> + </default-channels> + + <destination id="typed-object"> + <properties> + <source>org.apache.flex.blazeds.samples.typed.TypedObjectService</source> + </properties> + </destination> + </service> + </services> + + <security> + </security> + + <channels> + <channel-definition id="my-amf" class="mx.messaging.channels.AMFChannel"> + <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amf" class="flex.messaging.endpoints.AMFEndpoint"/> + <properties> + <polling-enabled>false</polling-enabled> + </properties> + </channel-definition> + + <channel-definition id="my-secure-amf" class="mx.messaging.channels.SecureAMFChannel"> + <endpoint url="https://{server.name}:{server.port}/{context.root}/messagebroker/amfsecure" class="flex.messaging.endpoints.SecureAMFEndpoint"/> + <properties> + <add-no-cache-headers>false</add-no-cache-headers> + </properties> + </channel-definition> + </channels> + + <validators> + <validator class="flex.messaging.validators.ClassDeserializationValidator"> + <properties> + <allow-classes> + <!-- TypedObjectService requires the following class: --> + <class name="org.apache.flex.blazeds.samples.typed.TypedObject"/> + <!-- + When providing a custom allowlist, the default allowlist + is disabled, so the following classes must be added too: + --> + <class name="flex.messaging.messages.*"/> + <class name="flex.messaging.io.*"/> + <class name="flex.messaging.io.amf.*"/> + </allow-classes> + </properties> + </validator> + </validators> + + <logging> + <target class="flex.messaging.log.ConsoleTarget" level="Error"> + <properties> + <prefix>[BlazeDS] </prefix> + <includeDate>false</includeDate> + <includeTime>false</includeTime> + <includeLevel>true</includeLevel> + <includeCategory>false</includeCategory> + </properties> + <filters> + <pattern>Endpoint.*</pattern> + <pattern>Service.*</pattern> + <pattern>Configuration</pattern> + </filters> + </target> + </logging> + + <system> + <redeploy> + <enabled>true</enabled> + <watch-interval>20</watch-interval> + <watch-file>{context.root}/WEB-INF/flex/services-config.xml</watch-file> + <touch-file>{context.root}/WEB-INF/web.xml</touch-file> + </redeploy> + </system> + +</services-config> diff --git a/samples/typed-object/backend/src/main/webapp/WEB-INF/web.xml b/samples/typed-object/backend/src/main/webapp/WEB-INF/web.xml new file mode 100755 index 0000000..172e153 --- /dev/null +++ b/samples/typed-object/backend/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,48 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + 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. + +--> +<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> +<web-app> + <display-name>BlazeDS Typed Object</display-name> + <description>BlazeDS Typed Object Sample Application</description> + + <listener> + <listener-class>flex.messaging.HttpFlexSession</listener-class> + </listener> + + <servlet> + <servlet-name>MessageBrokerServlet</servlet-name> + <display-name>MessageBrokerServlet</display-name> + <servlet-class>flex.messaging.MessageBrokerServlet</servlet-class> + <init-param> + <param-name>services.configuration.file</param-name> + <param-value>/WEB-INF/flex/services-config.xml</param-value> + </init-param> + <load-on-startup>1</load-on-startup> + </servlet> + + <servlet-mapping> + <servlet-name>MessageBrokerServlet</servlet-name> + <url-pattern>/messagebroker/*</url-pattern> + </servlet-mapping> + + <welcome-file-list> + <welcome-file>index.html</welcome-file> + </welcome-file-list> +</web-app> diff --git a/samples/typed-object/frontend/asconfig.json b/samples/typed-object/frontend/asconfig.json new file mode 100644 index 0000000..98edbf2 --- /dev/null +++ b/samples/typed-object/frontend/asconfig.json @@ -0,0 +1,19 @@ +{ + "config": "royale", + "compilerOptions": { + "targets": ["JSRoyale"], + "source-path": ["src/main/royale"], + "source-map": true, + "library-path": [ + "${royalelib}/libs/MXRoyaleBase.swc" + ], + "js-library-path": [ + "${royalelib}/js/libs/MXRoyaleBaseJS.swc" + ], + "html-template": "src/main/resources/index-template.html", + "theme": "${royalelib}/themes/JewelTheme/src/main/resources/defaults.css", + "js-output": "target/javascript" + }, + "mainClass": "Main" +} + diff --git a/samples/typed-object/frontend/pom.xml b/samples/typed-object/frontend/pom.xml new file mode 100644 index 0000000..5d6ea0b --- /dev/null +++ b/samples/typed-object/frontend/pom.xml @@ -0,0 +1,117 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + 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. + +--><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.flex.blazeds.samples.typed-object</groupId> + <artifactId>blazeds-typed-object-sample</artifactId> + <version>4.9.0-SNAPSHOT</version> + </parent> + + <groupId>org.apache.flex.blazeds.samples.typed-object</groupId> + <artifactId>blazeds-typed-object-frontend</artifactId> + <version>4.9.0-SNAPSHOT</version> + <packaging>swf</packaging> + + <name>Apache Flex BlazeDS: Typed Object Sample: Frontend</name> + + <build> + <sourceDirectory>src/main/royale</sourceDirectory> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <executions> + <execution> + <id>copy-themes</id> + <phase>generate-resources</phase> + <configuration> + <includes>defaults.css</includes> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.royale.compiler</groupId> + <artifactId>royale-maven-plugin</artifactId> + <version>0.9.11-SNAPSHOT</version> + <extensions>true</extensions> + <configuration> + <mainClass>Main.mxml</mainClass> + <targets>JSRoyale</targets> + <debug>false</debug> + <htmlTemplate>${basedir}/src/main/resources/index-template.html</htmlTemplate> + <keepAs3Metadata> + <name>Bindable</name> + <name>Managed</name> + <name>ChangeEvent</name> + <name>NonCommittingChangeEvent</name> + <name>Transient</name> + <name>Mixin</name> + </keepAs3Metadata> + <additionalCompilerOptions> + -js-dynamic-access-unknown-members=true; + -source-map=true; + </additionalCompilerOptions> + </configuration> + <dependencies> + <dependency> + <groupId>org.apache.royale.compiler</groupId> + <artifactId>compiler-jx</artifactId> + <version>0.9.11-SNAPSHOT</version> + </dependency> + </dependencies> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-war-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>build-helper-maven-plugin</artifactId> + </plugin> + </plugins> + </build> + + <dependencies> + <dependency> + <groupId>org.apache.royale.framework</groupId> + <artifactId>Jewel</artifactId> + <version>0.9.11-SNAPSHOT</version> + <type>swc</type> + <classifier>js</classifier> + </dependency> + <dependency> + <groupId>org.apache.royale.framework</groupId> + <artifactId>JewelTheme</artifactId> + <version>0.9.11-SNAPSHOT</version> + <type>swc</type> + <scope>theme</scope> + <classifier>js</classifier> + </dependency> + <dependency> + <groupId>org.apache.royale.framework</groupId> + <artifactId>MXRoyaleBase</artifactId> + <version>0.9.11-SNAPSHOT</version> + <type>swc</type> + <classifier>js</classifier> + </dependency> + </dependencies> +</project> diff --git a/samples/pom.xml b/samples/typed-object/frontend/src/main/resources/index-template.html similarity index 51% copy from samples/pom.xml copy to samples/typed-object/frontend/src/main/resources/index-template.html index 235ac21..140ba98 100644 --- a/samples/pom.xml +++ b/samples/typed-object/frontend/src/main/resources/index-template.html @@ -1,6 +1,4 @@ -<?xml version="1.0" encoding="UTF-8"?> <!-- - 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. @@ -15,26 +13,18 @@ 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. - --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <parent> - <groupId>org.apache.flex.blazeds</groupId> - <artifactId>blazeds</artifactId> - <version>4.9.0-SNAPSHOT</version> - </parent> - - <groupId>org.apache.flex.blazeds.samples</groupId> - <artifactId>blazeds-samples</artifactId> - <version>4.9.0-SNAPSHOT</version> - <packaging>pom</packaging> - - <name>Apache Flex BlazeDS: Samples</name> - - <modules> - <module>hello-world</module> - <module>classic-turnkey-samples</module> - </modules> -</project> +<!DOCTYPE html> +<html> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> + <meta name="Custom Template for injecting custom style CSS"> + <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0"> + <link rel="stylesheet" type="text/css" href="${application}.css"> + <link href="https://fonts.googleapis.com/css?family=Lato:400,700" rel="stylesheet"> +${head} +</head> +<body> +${body} +</body> +</html> diff --git a/samples/typed-object/frontend/src/main/royale/Main.mxml b/samples/typed-object/frontend/src/main/royale/Main.mxml new file mode 100644 index 0000000..ec207b6 --- /dev/null +++ b/samples/typed-object/frontend/src/main/royale/Main.mxml @@ -0,0 +1,112 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + + 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. + +--> +<j:Application + xmlns:fx="http://ns.adobe.com/mxml/2009" + xmlns:js="library://ns.apache.org/royale/basic" + xmlns:mx="library://ns.apache.org/royale/mx" + xmlns:j="library://ns.apache.org/royale/jewel" + xmlns:html="library://ns.apache.org/royale/html" + xmlns:sample="org.apache.flex.blazeds.samples.typed.*" + applicationComplete="onInit()"> + + <fx:Script> + <![CDATA[ + import mx.rpc.events.FaultEvent; + import mx.rpc.events.ResultEvent; + + import org.apache.flex.blazeds.samples.typed.TypedObject; + import org.apache.royale.jewel.Alert; + + [Bindable] + public var typedObject:TypedObject; + + private function onInit():void + { + srv.getTypedObject(); + } + + private function onSaveButtonClick():void + { + typedObject.string = stringInput.text; + typedObject.number = numberInput.value; + typedObject.boolean = booleanInput.selected; + srv.setTypedObject(typedObject); + } + + private function onGetTypedObjectResult(event:ResultEvent):void + { + typedObject = event.result as TypedObject; + } + + private function onSetTypedObjectResult(event:ResultEvent):void + { + Alert.show("The typed object has been saved", "Success"); + } + + private function onFault(event:FaultEvent):void + { + Alert.show(event.fault.faultString, "Fault"); + } + + ]]> + </fx:Script> + + <fx:Declarations> + <mx:RemoteObject id="srv" endpoint="/typed-object/messagebroker/amf" destination="typed-object"> + <mx:method name="getTypedObject" result="onGetTypedObjectResult(event)" fault="onFault(event)"/> + <mx:method name="setTypedObject" result="onSetTypedObjectResult(event)" fault="onFault(event)"/> + </mx:RemoteObject> + </fx:Declarations> + + <j:beads> + <js:ApplicationDataBinding/> + <js:ClassAliasBead/> + </j:beads> + + <j:valuesImpl> + <js:SimpleCSSValuesImpl/> + </j:valuesImpl> + + <j:initialView> + <j:ResponsiveView id="rootView"> + <j:Card width="100%" height="100%"> + <j:CardHeader> + <html:H3 text="TypedObject" className="primary-normal"/> + </j:CardHeader> + <j:CardPrimaryContent> + <j:Form> + <j:FormItem label="String"> + <j:TextInput id="stringInput" text="{typedObject.string}"/> + </j:FormItem> + <j:FormItem label="Number"> + <j:NumericStepper id="numberInput" value="{typedObject.number}"/> + </j:FormItem> + <j:FormItem label="Boolean"> + <j:CheckBox id="booleanInput" selected="{typedObject.boolean}"/> + </j:FormItem> + </j:Form> + </j:CardPrimaryContent> + <j:CardActions> + <j:Button text="Save" click="onSaveButtonClick()"/> + </j:CardActions> + </j:Card> + </j:ResponsiveView> + </j:initialView> +</j:Application> \ No newline at end of file diff --git a/samples/typed-object/frontend/src/main/royale/org/apache/flex/blazeds/samples/typed/TypedObject.as b/samples/typed-object/frontend/src/main/royale/org/apache/flex/blazeds/samples/typed/TypedObject.as new file mode 100644 index 0000000..42c53f3 --- /dev/null +++ b/samples/typed-object/frontend/src/main/royale/org/apache/flex/blazeds/samples/typed/TypedObject.as @@ -0,0 +1,29 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 org.apache.flex.blazeds.samples.typed +{ + [Bindable] + [RemoteClass(alias="org.apache.flex.blazeds.samples.typed.TypedObject")] + public class TypedObject + { + public var number:Number; + public var string:String; + public var boolean:Boolean; + } +} \ No newline at end of file diff --git a/samples/pom.xml b/samples/typed-object/pom.xml similarity index 78% copy from samples/pom.xml copy to samples/typed-object/pom.xml index 235ac21..12f2a6d 100644 --- a/samples/pom.xml +++ b/samples/typed-object/pom.xml @@ -21,20 +21,20 @@ <modelVersion>4.0.0</modelVersion> <parent> - <groupId>org.apache.flex.blazeds</groupId> - <artifactId>blazeds</artifactId> + <groupId>org.apache.flex.blazeds.samples</groupId> + <artifactId>blazeds-samples</artifactId> <version>4.9.0-SNAPSHOT</version> </parent> - <groupId>org.apache.flex.blazeds.samples</groupId> - <artifactId>blazeds-samples</artifactId> + <groupId>org.apache.flex.blazeds.samples.typed-object</groupId> + <artifactId>blazeds-typed-object-sample</artifactId> <version>4.9.0-SNAPSHOT</version> <packaging>pom</packaging> - <name>Apache Flex BlazeDS: Samples</name> + <name>Apache Flex BlazeDS: Typed Object Sample</name> <modules> - <module>hello-world</module> - <module>classic-turnkey-samples</module> + <module>frontend</module> + <module>backend</module> </modules> </project>