스프링 플 렉 스 결합

6454 단어 spring
1. BlazeDS 를 다운로드 하여 압축 을 풀 고 공사 에 넣 습 니 다.
2. 프로젝트 에 Srping 과 spring - flex 의 패키지 org. springframework. flex - 1.0.3. RELEASE. jar 를 추가 합 니 다.BlazeDS 버 전이 4.0 이면 spring - flex 패키지 버 전이 너무 높 으 면 안 됩 니 다. 그렇지 않 으 면 시작 할 때 오류 가 발생 할 수 있 습 니 다.
3. 웹. xml 수정
 
<?xml version="1.0" encoding="UTF-8"?>
<!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</display-name>
    <description>BlazeDS Application</description>

    <!-- Spring    ,    spring        -->
    <context-param>
      <param-name>contextConfigLocation</param-name>
      <param-value>
          /WEB-INF/config/applicationContext.xml
      </param-value>
    </context-param>

	<listener> 
	    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> 
	</listener>

    <!-- Http Flex Session attribute and binding listener support -->
    <listener>
        <listener-class>flex.messaging.HttpFlexSession</listener-class>
    </listener>
    
    <servlet>  
        <servlet-name>Spring MVC Dispatcher Servlet</servlet-name>  
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>  
	        <init-param>
                    <!--  flex     spring     -->
	            <param-name>contextConfigLocation</param-name>  
	            <param-value>/WEB-INF/config/flex-application-config.xml</param-value>  
	        </init-param>
        <load-on-startup>1</load-on-startup>  
    </servlet>  

<!-- RDS  ,  Flash Builderw        ,              Java            -->
<!-- begin rds -->
    <servlet>
        <servlet-name>RDSDispatchServlet</servlet-name>
		<display-name>RDSDispatchServlet</display-name>
        <servlet-class>flex.rds.server.servlet.FrontEndServlet</servlet-class>
		<init-param>
			<param-name>useAppserverSecurity</param-name>
			<param-value>false</param-value>
		</init-param>
        <init-param>
            <param-name>messageBrokerId</param-name>
            <param-value>_messageBroker</param-value>
        </init-param>
        <load-on-startup>10</load-on-startup>
    </servlet>
<!-- end rds -->

    <!-- Map /spring/* requests to the DispatcherServlet -->  
    <servlet-mapping>  
        <servlet-name>Spring MVC Dispatcher Servlet</servlet-name>  
        <url-pattern>/messagebroker/*</url-pattern>  
    </servlet-mapping> 

    <servlet-mapping id="RDS_DISPATCH_MAPPING">
        <servlet-name>RDSDispatchServlet</servlet-name>
        <url-pattern>/CFIDE/main/ide.cfm</url-pattern>
    </servlet-mapping>

    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>

    <!-- for WebSphere deployment, please uncomment -->
    <!--
    <resource-ref>
        <description>Flex Messaging WorkManager</description>
        <res-ref-name>wm/MessagingWorkManager</res-ref-name>
        <res-type>com.ibm.websphere.asynchbeans.WorkManager</res-type>
        <res-auth>Container</res-auth>
        <res-sharing-scope>Shareable</res-sharing-scope>
    </resource-ref>
    -->

</web-app>

 
 
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:flex="http://www.springframework.org/schema/flex"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
		http://www.springframework.org/schema/flex http://www.springframework.org/schema/flex/spring-flex-1.0.xsd">

	<bean id="_messageBroker"  
        class="org.springframework.flex.core.MessageBrokerFactoryBean">  
        <!-- <property name="servicesConfigPath">  
            <value>/WEB-INF/flex/services-config.xml</value>  
        </property> -->
    </bean>  
    <!-- Maps request paths at /* to the BlazeDS MessageBroker -->  
    <bean  
        class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">  
        <property name="mappings">  
            <value>/*=_messageBroker</value>
        </property>  
    </bean>  
  
    <!-- Dispatches requests mapped to a MessageBroker -->  
    <bean  
        class="org.springframework.flex.servlet.MessageBrokerHandlerAdapter" />

    <bean id="rscLayersCfgAction" class="com.linkage.app.action.RscLayersCfgAction">
        <property name="service" ref="rscLayersCfgService"></property>
    </bean>
    <bean id="rscGridMsgAction" class="com.linkage.app.action.RscGridMsgAction">
        <property name="service" ref="rscGridMsgService"></property>
    </bean>

	<!--    flex            -->
    <flex:remoting-destination ref="rscLayersCfgAction" include-methods="getRscLayersCfgs"/>
    <flex:remoting-destination ref="rscGridMsgAction" include-methods="addRscGridMsg"/>
</beans>

좋은 웹페이지 즐겨찾기