Seasar2+S2BlazeDS+Flex3进行数据传输

接上例:http://blog.csdn.net/kunshan_shenbin/archive/2009/02/15/3892702.aspx

本例将使用Seasar2+S2BlazeDS+Flex3组合。

如下图所示建立工程:

Seasar2+S2BlazeDS+Flex3进行数据传输_第1张图片

代码如下:

User.java和DemoService.java文件和上例一致。

app.dicon

<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE components PUBLIC "-//SEASAR//DTD S2Container 2.4//EN" "http://www.seasar.org/dtd/components24.dtd"> <components> <component name="DemoService" class="com.flex.service.DemoService" /> </components>

remoting-config.xml

<?xml version="1.0" encoding="UTF-8"?> <service id="remoting-service" class="flex.messaging.services.RemotingService"> <adapters> <adapter-definition id="s2-object" class="org.seasar.blazeds.adapters.S2Adapter" default="true"/> <!-- <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="DemoService"/> <!-- <destination id="DemoService" > <properties> <source>com.flex.service.DemoService</source> </properties> </destination> --> </service>

services-config.xml

<?xml version="1.0" encoding="UTF-8"?> <services-config> <services> <service-include file-path="remoting-config.xml" /> </services> <channels> <channel-definition id="my-amf" class="mx.messaging.channels.AMFChannel" > <endpoint url="http://{server.name}:{server.port}/Flex4jWeb/messagebroker/amf" class="org.seasar.blazeds.endpoints.S2AMFEndpoint"/> <!-- <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amf" class="org.seasar.blazeds.endpoints.S2AMFEndpoint"/> --> </channel-definition> </channels> <logging> <target class="flex.messaging.log.ConsoleTarget" level="Error"> <properties> <prefix>[BlazeDS] </prefix> <includeDate>false</includeDate> <includeTime>false</includeTime> <includeLevel>false</includeLevel> <includeCategory>false</includeCategory> </properties> <filters> <pattern>Endpoint.*</pattern> <pattern>Service.*</pattern> <pattern>Configuration</pattern> </filters> </target> </logging> <system> <redeploy> <enabled>false</enabled> </redeploy> </system> </services-config>

web.xml

<?xml version="1.0" encoding="UTF-8"?> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> <display-name>Flex4jWeb</display-name> <description>Flex4jWeb</description> <context-param> <param-name>flex.class.path</param-name> <param-value>/WEB-INF/flex/hotfixes</param-value> </context-param> <listener> <listener-class>flex.messaging.HttpFlexSession</listener-class> </listener> <filter> <filter-name>s2filter</filter-name> <filter-class>org.seasar.framework.container.filter.S2ContainerFilter</filter-class> </filter> <filter-mapping> <filter-name>s2filter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <servlet> <servlet-name>s2container</servlet-name> <servlet-class> org.seasar.framework.container.servlet.S2ContainerServlet </servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet> <servlet-name>MessageBrokerServlet</servlet-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>2</load-on-startup> </servlet> <servlet-mapping> <servlet-name>s2container</servlet-name> <url-pattern>/s2container</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>MessageBrokerServlet</servlet-name> <url-pattern>/messagebroker/*</url-pattern> </servlet-mapping> </web-app>

你可能感兴趣的:(Seasar2+S2BlazeDS+Flex3进行数据传输)