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. 超级计算机排名表格,全球超级计算机500强_科技时代首页_新浪网
  2. 成功解决CondaError: Error reading file, file should be a text file containing packages conda create --he
  3. 一个最简单的Makefile例子(转)
  4. Selenium 中文手册
  5. 1.1 了解web性能
  6. Go 字典(Map)
  7. LeetCode 5355. T 秒后青蛙的位置
  8. 【论文】赛尔原创 | EMNLP 2019基于知识库检索器的实体一致性端到端任务型对话系统...
  9. 理解Golang包导入,import、包名、目录名的关系
  10. 【车牌识别】基于matlab GUI模板匹配车牌识别门禁系统【含Matlab源码 1091期】
  11. 使用EditPlus运行C/C++
  12. R 实战学生成绩描述分析
  13. 流媒体协议(三):FLV协议
  14. 从“领域变迁”的视角,来看钉钉的“退让”与“进取”
  15. 大林算法计算机控制实验报告,实验二 大林算法实验报告
  16. Mysql存储引擎Innodb的读写锁、行级锁
  17. SharpDevelop的安装与配置
  18. Android Studio 的ListView 的用法
  19. AutoCAD2014打开一闪而过解决方法
  20. delphi10.4使用uniGUI

热门文章

  1. 笔记本电脑攻略丨笔记本电脑配置怎么看与笔记本电脑验机方法
  2. Ubuntu16.04安装国际版QQ教程
  3. linux环境编程 百度云,linux环境下使用百度云网盘
  4. vue实现dom元素拉伸
  5. Qt 之 自定义窗口标题栏 之 窗口拉伸
  6. 叉叉xsp能反编译吗_iPhone 你还需要越狱吗?
  7. 智能化金融新范本 银联商务与百度智能云合作再升级
  8. flax.optim 引入错误
  9. CVPR2021|ACNet再进化,清华大学旷视科技提出Inception类型的DBB
  10. Tomcat 实用安装教程