1、下载lcds,安装完成后,解压lcds.war.

2、新建webProject,拷贝解压后的lcds中的所有内容覆盖新建工程的WebRoot中的相应内容。

3、到此为止,我们的工程就有了lcds的功能。

4、发布工程并启动。

5、如果启动过程中没有什么异常,开始整合spring,如果有异常,重复上述几步。

6、为工程添加spring特性,相信用过Myeclipse的童鞋对这个应该不会陌生。

7、在web.xml中增加spring的初始化工作,这里给出我的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>LiveCycle Data Services</display-name>
<description>LiveCycle Data Services Application</description>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
<!-- Spring ContextLoaderListener (Not needed if you don't use Spring) -->
<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>
<!-- MessageBroker Servlet -->
<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>
<!-- 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>true</param-value>
</init-param>
<load-on-startup>10</load-on-startup>
</servlet>
<servlet-mapping id="RDS_DISPATCH_MAPPING">
<servlet-name>RDSDispatchServlet</servlet-name>
<url-pattern>/CFIDE/main/ide.cfm</url-pattern>
</servlet-mapping>
end rds -->
<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>index.htm</welcome-file>
</welcome-file-list>
<!-- for WebSphere deployment, please uncomment -->
<!--
<resource-ref>
<description>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>

8、增加一个spring的工厂类,我的上一篇给出了源码,注意如果有编译错误,可能是需要的spring包没有加到buildPath中,请加入所需的spring的包,同样这里再给出源码.

package springFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import flex.messaging.FactoryInstance;
import flex.messaging.FlexFactory;
import flex.messaging.config.ConfigMap;
import flex.messaging.services.ServiceException;
public class SpringFactory implements FlexFactory
{
private static final String SOURCE = "source";
public void initialize(String id, ConfigMap configMap) {}
public FactoryInstance createFactoryInstance(String id, ConfigMap properties)
{
SpringFactoryInstance instance = new SpringFactoryInstance(this, id, properties);
instance.setSource(properties.getPropertyAsString(SOURCE, instance.getId()));
return instance;
} // end method createFactoryInstance()
public Object lookup(FactoryInstance inst)
{
SpringFactoryInstance factoryInstance = (SpringFactoryInstance) inst;
return factoryInstance.lookup();
}
static class SpringFactoryInstance extends FactoryInstance
{
SpringFactoryInstance(SpringFactory factory, String id, ConfigMap properties)
{
super(factory, id, properties);
}
public String toString()
{
return "SpringFactory instance for id=" + getId() + " source=" + getSource() + " scope=" + getScope();
}
public Object lookup()
{
ApplicationContext appContext = WebApplicationContextUtils.getWebApplicationContext(flex.messaging.FlexContext.getServletConfig().getServletContext());
String beanName = getSource();
try
{
return appContext.getBean(beanName);
}
catch (NoSuchBeanDefinitionException nexc)
{
ServiceException e = new ServiceException();
String msg = "Spring service named '" + beanName + "' does not exist.";
e.setMessage(msg);
e.setRootCause(nexc);
e.setDetails(msg);
e.setCode("Server.Processing");
throw e;
}
catch (BeansException bexc)
{
ServiceException e = new ServiceException();
String msg = "Unable to create Spring service named '" + beanName + "' ";
e.setMessage(msg);
e.setRootCause(bexc);
e.setDetails(msg);
e.setCode("Server.Processing");
throw e;
}
}
}
}

9、在services-config中增加一个spring工厂,注意位置在<security>之前。

 <factories>
<factory id="spring" class="springFactory.SpringFactory" />
</factories>

10、在remoting-config中增加一个destination。

<?xml version="1.0" encoding="UTF-8"?>
<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="testHello">
<properties>
<factory>spring</factory>
<source>hello</source>
</properties>
</destination>
</service>

11、在applicationContext中配置bean。

<?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:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<bean id="hello" class="flexServer.RemoteObject"></bean>
</beans>

12、启动应用,在flex中调用,下面给出我的测试类的源码:

package flexServer;
public class RemoteObject {
public String sayHello(String msg){
return "Hello,"+msg;
}
public String sayFuck(String msg){
return "fuck,"+msg;
}
}

13、给出MXML的使用代码:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" height="534" width="1122">
<mx:Binding source="text_c.text" destination="text_d.text"/>
<mx:Script>
<![CDATA[
import mx.rpc.events.ResultEvent;
import mx.controls.Alert;
private function callRO(str:String):void{
firstRO.sayFuck(str);
firstRO.addEventListener(ResultEvent.RESULT,getROResult);
}
private function callRO2(str:String):void{
firstRO.sayHello(str);
firstRO.addEventListener(ResultEvent.RESULT,getROResult);
}
private function getROResult(e:ResultEvent) :void {
Alert.show(e.result.toString());
}
]]>
</mx:Script>
<mx:RemoteObject id="firstRO" destination="testHello"/>
<mx:Panel width="1108" height="411" layout="absolute" title="我的面板">
<mx:Button click="callRO('stone')" label="fuck"  x="420.5" y="328" width="100"/>
<mx:Button click="callRO2('stone')" label="Hello"  x="572.5" y="328" width="100"/>
</mx:Panel>
</mx:Application>

14、运行flex吧!看是不是两个按钮都给你打招呼啊!只是有个不太友好啊!

flex结合Lcds整合spring相关推荐

  1. Flex整合Spring

    工程需要整合Spring和Flex,在网上众多方法中找到了下面这种,记录留存. 个人认为该方法更适合在已有Spring框架的工程中添加Flex时使用,对原工程内容(主要指配置文件)改动较小. 1.添加 ...

  2. Flex BlazeDS整合Spring在Tomcat下的安全验证

    Flex BlazeDS整合Spring在Tomcat下的安全验证 今天看了BlazeDS Developer Guide,在Tomcat在利用BASIC方法做了个安全验证的实例.Flex Blaze ...

  3. spring boot整合spring security笔记

    最近自己做了一个小项目,正在进行springboot和spring Security的整合,有一丢丢的感悟,在这里分享一下: 首先,spring boot整合spring security最好是使用T ...

  4. Echache整合Spring缓存实例讲解

    2019独角兽企业重金招聘Python工程师标准>>> 摘要:本文主要介绍了EhCache,并通过整合Spring给出了一个使用实例. 一.EhCache 介绍 EhCache 是一 ...

  5. 八、springboot整合Spring Security

    springboot整合Spring Security 简介 Spring Security是一个功能强大且可高度自定义的身份验证和访问控制框架.它是保护基于Spring的应用程序的事实标准. Spr ...

  6. Activiti工作流从入门到入土:整合spring

    文章源码托管:https://github.com/OUYANGSIHAI/Activiti-learninig 欢迎 star !!! 一.前言 在上一节中,通过一个入门程序,把activiti的环 ...

  7. springboot2 war页面放在那_Spring Boot2 系列教程(三十三)整合 Spring Security

    Spring Security 是 Spring 家族中的一个安全管理框架,实际上,在 Spring Boot 出现之前,Spring Security 就已经发展了多年了,但是使用的并不多,安全管理 ...

  8. springboot templates读取不到_整合spring mvc + mybatis,其实很简单,spring boot实践(5)

    01 spring boot读取配置信息 02 多环境配置 03 处理全局异常 04 spring boot admin 主要通过spring boot整合spring mvc 以及mybatis实现 ...

  9. springboot整合hibernate_峰哥说技术系列-17 .Spring Boot 整合 Spring Data JPA

    今日份主题 Spring Boot 整合 Spring Data JPA JPA(Java Persistence API)是用于对象持久化的 API,是Java EE 5.0 平台标准的 ORM 规 ...

最新文章

  1. R语言ggplot2可视化:修改已经创建的ggplot2可视化对象进行自定义的修改、使用ggplot_build函数更改已经创建的可视化结果
  2. SAP QM 执行事务代码QE01为检验批录入结果直接进入Multiple Specification标签页?
  3. android studio annotations,AndroidAnnotations在Android Studio中的配置
  4. 光纤有什么优势?还有哪些挑战需要面对呢?
  5. python流获取控制台_对Python捕获控制台输出流的方法详解
  6. 安德鲁斯Selector简介
  7. autoLayout自动布局
  8. c语言double root,C语言修仙
  9. 要让玩家买单的facebook中文网
  10. 苹果紧急修复已遭利用的两个0day
  11. 浏览器重定向(302)次数限制问题
  12. 反编译python编写的exe文件的详细方法
  13. python播放音乐同步歌词_Python零基础学习代码实践 —— 模拟播放器中的歌词显示...
  14. input onchange事件不触发 oninput onpropertychange onchange 实时监听
  15. Fiddler抓包工具+夜神模拟器
  16. 在线3D大脑建模网站分享
  17. WIN10系统安装虚拟机以及CentOS7
  18. svg图片调整大小和颜色
  19. 如何判断BUG是前端BUG还是后端BUG
  20. android解决kotlin问题Expecting member declaration

热门文章

  1. 麓言信息室内设计师必知的15个网站
  2. 精准数据爬取(精抽取)的爬虫选择问题
  3. 无源蜂鸣器与播放音乐(总结)
  4. 中国房价2011上涨2012崩溃
  5. SSM家庭理财个人理财系统-JAVA【数据库设计、源码、开题报告】
  6. CentOS7 Error downloading packages 解决办法
  7. WIN11/win10+Azure Kinect DK详细驱动配置教程(亲测)
  8. springboot的定时任务的方法周期比方法的运行时间长
  9. 金融机构数据库自主可控之路——路远,需尽早(SinoDB)
  10. matlab神经网络建模程序,人工神经网络建模matlab..ppt