Sample java blazes project to test FlexJS AMF
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/5a08a9c2 Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/5a08a9c2 Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/5a08a9c2 Branch: refs/heads/feature/amf Commit: 5a08a9c2150ca7aa647fc4c5621e022b0b21cb9d Parents: 78a8dfa Author: Carlos Rovira <carlosrov...@apache.org> Authored: Sat Feb 18 17:34:44 2017 +0100 Committer: Carlos Rovira <carlosrov...@apache.org> Committed: Mon Feb 20 16:34:20 2017 +0100 ---------------------------------------------------------------------- examples/sampleamfwebapp/.vscode/tasks.json | 9 ++ examples/sampleamfwebapp/pom.xml | 92 ++++++++++++++++++++ .../BlazeDSSpringBootApplication.java | 35 ++++++++ .../amfsamples/services/ExampleService.java | 34 ++++++++ .../resources/META-INF/flex/services-config.xml | 83 ++++++++++++++++++ 5 files changed, 253 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5a08a9c2/examples/sampleamfwebapp/.vscode/tasks.json ---------------------------------------------------------------------- diff --git a/examples/sampleamfwebapp/.vscode/tasks.json b/examples/sampleamfwebapp/.vscode/tasks.json new file mode 100644 index 0000000..e562c32 --- /dev/null +++ b/examples/sampleamfwebapp/.vscode/tasks.json @@ -0,0 +1,9 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=733558 + // for the documentation about the tasks.json format + "version": "0.1.0", + "command": "mvn", + "args": ["clean", "install", "-DskipTests"], + "isShellCommand": true, + "showOutput": "always" +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5a08a9c2/examples/sampleamfwebapp/pom.xml ---------------------------------------------------------------------- diff --git a/examples/sampleamfwebapp/pom.xml b/examples/sampleamfwebapp/pom.xml new file mode 100644 index 0000000..2525062 --- /dev/null +++ b/examples/sampleamfwebapp/pom.xml @@ -0,0 +1,92 @@ +<?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> + + <groupId>org.apache.flex.amfsamples</groupId> + <artifactId>sampleamfwebapp</artifactId> + <version>0.8.0-SNAPSHOT</version> + <packaging>war</packaging> + + <build> + <plugins> + <!-- Make Spring-Boot build an executable war --> + <plugin> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> + <version>1.3.3.RELEASE</version> + <executions> + <execution> + <goals> + <goal>repackage</goal> + </goals> + </execution> + </executions> + <configuration> + <classifier>exec</classifier> + </configuration> + </plugin> + <!-- + We are building a servlet 3.0 application we don't + need a web.xml, so we have to disable a check on the + plugin. + --> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-war-plugin</artifactId> + <configuration> + <failOnMissingWebXml>false</failOnMissingWebXml> + <overlays> + <overlay> + <groupId>org.apache.flex.flexjs.examples</groupId> + <artifactId>RemoteObjectAMFTest</artifactId> + </overlay> + </overlays> + </configuration> + </plugin> + </plugins> + </build> + + <dependencies> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-context</artifactId> + <version>4.3.2.RELEASE</version> + </dependency> + + <!-- + This will pull in and configure the servlet engine as + well as the BlazeDS server. + --> + <dependency> + <groupId>org.apache.flex.blazeds</groupId> + <artifactId>blazeds-spring-boot-starter</artifactId> + <version>4.7.3-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>org.apache.flex.flexjs.examples</groupId> + <artifactId>RemoteObjectAMFTest</artifactId> + <version>0.8.0-SNAPSHOT</version> + <type>war</type> + </dependency> + + </dependencies> + +</project> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5a08a9c2/examples/sampleamfwebapp/src/main/java/org/apache/flex/amfsamples/BlazeDSSpringBootApplication.java ---------------------------------------------------------------------- diff --git a/examples/sampleamfwebapp/src/main/java/org/apache/flex/amfsamples/BlazeDSSpringBootApplication.java b/examples/sampleamfwebapp/src/main/java/org/apache/flex/amfsamples/BlazeDSSpringBootApplication.java new file mode 100644 index 0000000..dd2d8b5 --- /dev/null +++ b/examples/sampleamfwebapp/src/main/java/org/apache/flex/amfsamples/BlazeDSSpringBootApplication.java @@ -0,0 +1,35 @@ +/* + * + * 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.amfsamples; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.web.servlet.ServletComponentScan; + +@SpringBootApplication +@ServletComponentScan("org.apache.flex.amfsamples") +public class BlazeDSSpringBootApplication { + + public static void main(String[] args) { + SpringApplication application = new SpringApplication(BlazeDSSpringBootApplication.class); + application.run(args); + } + +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5a08a9c2/examples/sampleamfwebapp/src/main/java/org/apache/flex/amfsamples/services/ExampleService.java ---------------------------------------------------------------------- diff --git a/examples/sampleamfwebapp/src/main/java/org/apache/flex/amfsamples/services/ExampleService.java b/examples/sampleamfwebapp/src/main/java/org/apache/flex/amfsamples/services/ExampleService.java new file mode 100644 index 0000000..324e59f --- /dev/null +++ b/examples/sampleamfwebapp/src/main/java/org/apache/flex/amfsamples/services/ExampleService.java @@ -0,0 +1,34 @@ +/* + * + * 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.amfsamples.services; + +import org.springframework.flex.remoting.RemotingDestination; +import org.springframework.stereotype.Service; + +@Service("exampleService") +@RemotingDestination +public class ExampleService { + + public String echo(String name) { + System.out.println(String.format("Got message from: %s", name)); + return String.format("Hello %s", name); + } + +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5a08a9c2/examples/sampleamfwebapp/src/main/resources/META-INF/flex/services-config.xml ---------------------------------------------------------------------- diff --git a/examples/sampleamfwebapp/src/main/resources/META-INF/flex/services-config.xml b/examples/sampleamfwebapp/src/main/resources/META-INF/flex/services-config.xml new file mode 100644 index 0000000..47f9a75 --- /dev/null +++ b/examples/sampleamfwebapp/src/main/resources/META-INF/flex/services-config.xml @@ -0,0 +1,83 @@ +<?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="websocketAmf"/> + <channel ref="longPollingAmf"/> + <channel ref="shortPollingAmf"/> + </default-channels> + </service> + </services> + + <channels> + <channel-definition id="websocketAmf" class="mx.messaging.channels.StreamingAMFChannel"> + <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/websocket-amf" + class="flex.messaging.endpoints.StreamingAMFEndpoint"/> + <properties> + <server-to-client-heartbeat-millis>5000</server-to-client-heartbeat-millis> + <add-no-cache-headers>true</add-no-cache-headers> + </properties> + </channel-definition> + <channel-definition id="longPollingAmf" class="mx.messaging.channels.AMFChannel"> + <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/long-polling-amf" + class="flex.messaging.endpoints.AMFEndpoint"/> + <properties> + <polling-enabled>true</polling-enabled> + <wait-interval-millis>0</wait-interval-millis> + <polling-interval-millis>1000</polling-interval-millis> + <max-waiting-poll-requests>100</max-waiting-poll-requests> + <piggybacking-enabled>true</piggybacking-enabled> + <add-no-cache-headers>true</add-no-cache-headers> + </properties> + </channel-definition> + <channel-definition id="shortPollingAmf" class="mx.messaging.channels.AMFChannel"> + <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/short-polling-amf" + class="flex.messaging.endpoints.AMFEndpoint"/> + <properties> + <polling-enabled>true</polling-enabled> + <polling-interval-millis>3000</polling-interval-millis> + <piggybacking-enabled>true</piggybacking-enabled> + <add-no-cache-headers>true</add-no-cache-headers> + </properties> + </channel-definition> + </channels> + + <flex-client> + <!-- Make sure clients are automatically expired --> + <timeout-minutes>720</timeout-minutes> + </flex-client> + + <logging> + <!-- + Logging inside BlazeDS is completely turned off. + The UniversalExceptionTranslator will handle logging + of exceptions inside Spring. + --> + <target class="flex.messaging.log.ConsoleTarget" level="None"/> + </logging> +</services-config> \ No newline at end of file