- 浏览: 120927 次
- 性别:
- 来自: 北京
最新评论
-
NewTamato:
你的这个写的全都是代码,不知道对于flex和spring整合的 ...
Flex+BlazeDS+Spring的一个项目笔记(2) -
agurick:
laowood 写道在不写的一般情况下都是auto吧?自动变量 ...
C中的寄存器变量和引用变量 -
laowood:
agurick 写道补充一下,auto已经过时,已经不再使用。 ...
C中的寄存器变量和引用变量 -
agurick:
补充一下,auto已经过时,已经不再使用。static 变量就 ...
C中的寄存器变量和引用变量 -
ming:
oooooooo
domino如何在数据库中存储信息
applicationContext.xml 配置如下
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"> <bean id="loginBean" class="com.lms.shop.login.LoginDAO"> <property name="dataSource" ref="websphereDataSource"></property> </bean>
<!--data source 是从 websphere配置的 jndi 获取--> <bean id="websphereDataSource" class="org.springframework.jndi.JndiObjectFactoryBean"> <property name="jndiName" value="webspherejndi"/> <property name="resourceRef" value="false"/> </bean>
<!--事务管理--> <bean id="trans" class="org.springframework.transaction.jta.WebSphereTransactionManagerFactoryBean"/> <bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager"> <property name="transactionManager" ref="trans"/> </bean> </beans>
flex 有四个配置文件不可缺少 在 flex文件夹下可以看到
三种通信方式的配置(messaging-config.xml,proxy-config.xml,remoting-config.xml)和总控配置(services-config.xml).
此工程中只用到了 remoting通信方式,简单灵活。
为了让spring 来管理 flex 和 服务器端通信 services-config.xml 稍微修改一下。
<?xml version="1.0" encoding="UTF-8"?>
<services-config>
<services>
<service-include file-path="remoting-config.xml" />
</services>
<!--这里配置一个 factorices -->
<factories>
<factory id="spring" class="com.lms.shop.factories.SpringFactory"/>
</factories>
<security>
<login-command class="flex.messaging.security.WebSphereLoginCommand" server="WebSphere"/>
</security>
<channels>
<channel-definition id="my-amf" class="mx.messaging.channels.AMFChannel">
<endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amf" class="flex.messaging.endpoints.AMFEndpoint"/>
</channel-definition>
<channel-definition id="my-secure-amf" class="mx.messaging.channels.SecureAMFChannel">
<endpoint url="https://{server.name}:{server.port}/{context.root}/messagebroker/amfsecure" class="flex.messaging.endpoints.SecureAMFEndpoint"/>
<properties>
<add-no-cache-headers>false</add-no-cache-headers>
</properties>
</channel-definition>
<channel-definition id="my-polling-amf" class="mx.messaging.channels.AMFChannel">
<endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amfpolling" class="flex.messaging.endpoints.AMFEndpoint"/>
<properties>
<polling-enabled>true</polling-enabled>
<polling-interval-seconds>4</polling-interval-seconds>
</properties>
</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>
SpringFactory.java 的内容如下 ,,客户端调用的 FlexServlet 全由这个工厂来生成
package com.lms.shop.factories; 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; /** * This interface is implemented by factory components which provide * instances to the flex messaging framework. To configure flex data services * to use this factory, add the following lines to your services-config.xml * file (located in the WEB-INF/flex directory of your web application). * * <factories> * <factory id="spring" class="flex.samples.factories.SpringFactory" /> * </factories> * * You also must configure the web application to use spring and must copy the spring.jar * file into your WEB-INF/lib directory. To configure your app server to use spring, * you add the following lines to your WEB-INF/web.xml file: * * <context-param> * <param-name>contextConfigLocation</param-name> * <param-value>/WEB-INF/applicationContext.xml</param-value> * </context-param> * * <listener> * <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> * </listener> * * Then you put your spring bean configuration in WEB-INF/applicationContext.xml (as per the * line above). For example: * * <?xml version="1.0" encoding="UTF-8"?> * <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> * * <beans> * <bean name="weatherBean" class="dev.weather.WeatherService" singleton="true"/> * </beans> * * Now you are ready to define a destination in flex that maps to this existing service. * To do this you'd add this to your WEB-INF/flex/remoting-config.xml: * * <destination id="WeatherService"> * <properties> * <factory>spring</factory> * <source>weatherBean</source> * </properties> * </destination> * * @author Jeff Vroom */ public class SpringFactory implements FlexFactory { private static final String SOURCE = "source"; /** * This method can be used to initialize the factory itself. It is called with configuration * parameters from the factory tag which defines the id of the factory. */ public void initialize(String id, ConfigMap configMap) {} /** * This method is called when we initialize the definition of an instance * which will be looked up by this factory. It should validate that * the properties supplied are valid to define an instance. * Any valid properties used for this configuration must be accessed to * avoid warnings about unused configuration elements. If your factory * is only used for application scoped components, this method can simply * return a factory instance which delegates the creation of the component * to the FactoryInstance's lookup method. */ 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() /** * Returns the instance specified by the source * and properties arguments. For the factory, this may mean * constructing a new instance, optionally registering it in some other * name space such as the session or JNDI, and then returning it * or it may mean creating a new instance and returning it. * This method is called for each request to operate on the * given item by the system so it should be relatively efficient. * <p> * If your factory does not support the scope property, it * report an error if scope is supplied in the properties * for this instance. */ 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; } } } }
发表评论
-
redhat 安装 oracle
2013-01-23 12:02 1088装完RHEL5之后遇到的 第一个问题 通过SSH ... -
fedora 14上安装 Oracle 11g
2011-03-31 12:48 4130本文介绍了在Fedora 14 64-bit上安装Or ... -
Flex+BlazeDS+Spring的一个项目笔记(1)
2009-07-29 23:43 1689把最近在做的一个项目的研究成果贴出来做个笔记。项目是要做一个本 ... -
SQL能完成的逻辑都在SQL中
2009-07-21 19:16 1062decode, case的用法 select t.star ... -
Promises don't come easy
2009-05-11 13:48 1169I should have known all along ... -
oracle 9*9乘法口诀表
2009-04-14 18:19 2025select replace(reverse(sys_conn ... -
oracle笔记1
2009-03-31 22:52 1497conn / as sysdba -切换到sys用户 sele ... -
C中的寄存器变量和引用变量
2009-03-25 19:11 5654总共有auto,static,register,extern。 ... -
shell 初步
2009-03-15 18:24 3621ps -ef | grep redis du -sh 查看文件 ... -
File ToBase64String
2009-02-03 15:00 1258public static string Serializ ... -
David Cook - Always Be My Baby
2008-11-05 18:28 1359Studio Version Song ... -
企业应用中C\S是怎样的架构?
2008-10-31 10:19 4059我们公司开发程序一般是 C# Winform 做客户端,EJB ... -
C#画图
2008-10-24 10:06 2399翻出以前刚到公司自己做的这个,以前查资料作了半天,发现 现在 ... -
Can’t find P/Invoke DLL sqlcemeNN.dll
2008-09-01 11:30 2427Can’t find P/Invoke DLL sqlceme ... -
JavaScript replace() 方法
2008-08-27 13:43 2302定义和用法 replace() 方法用于在字符串中 ... -
C# 写Excel 代码
2008-08-20 12:48 10929C# 中使用 Excel using System;usin ... -
开发基于Domino/Notes的动态Web网站
2007-09-27 08:08 1510开发基于Domino/Notes的动态Web网站 用户的需求 ... -
[精华]Linux记事本最常用的命令,迅速掌握Linux
2008-06-28 09:51 4404自己整理的笔记,,适合linux初学者,老手就不要看了,呵呵 ... -
Java移动文件
2008-06-14 19:50 34543一: //文件原地址 File oldFile = ne ... -
大道至简-java之23种模式一点就通
2008-06-12 10:23 1620一、创建型模式 FACTORY ...
相关推荐
本篇笔记主要介绍了如何将 Flex4、Blazeds4.0、Spring3.0 和 hibernate2.5.2 进行整合,实现一个完整的富互联网应用程序。下面是对笔记中关键部分的详细解释: 准备工作 在开始整合之前,需要准备以下软件和资源:...
2. **Flex与Spring的通信**:介绍 BlazeDS 或 GraniteDS 等中间件,它们作为Flex和Spring应用之间的桥梁,处理AMF(Action Message Format)消息的传输,使得Flex客户端可以调用后端的Spring服务。 3. **Flex的数据...
4. "Flex 开发学习笔记2 - 采用的架构 BlazeDS + Spring + Hibernate" 可能是一个开发者的学习笔记,详细记录了构建基于这三个技术的完整应用过程,包括配置、数据绑定和事务管理。 5. "快速搭建Spring BlazeDS ...
【Flex学习笔记】这篇笔记主要涉及的技术栈是Flex框架,结合BlazeDS、Spring和Hibernate进行Web应用开发。Flex是一种用于构建富互联网应用程序(RIA)的客户端技术,它基于ActionScript和MXML,通常用于创建交互式的...
2. **BlazeDS**: BlazeDS 是 Adobe 提供的一个开源项目,它允许 Flex 客户端与Java服务器进行实时的双向通信。在本例中,BlazeDS 作为 Flex 和 Hibernate 集成的中间件,实现了 AMF (Action Message Format) 数据...
BlazeDS是Adobe公司推出的一款开源的服务器端技术,它主要负责在Flex应用程序与Java后端之间提供数据推送服务,实现了富互联网应用(RIA)与服务器之间的实时通信。本资料包包含了两份重要的资源,分别是《BlazeDS...
新建 文本文档.txt 可能是与这个项目相关的文档,但没有更具体的信息,我们只能猜测它可能是安装指南、API参考、示例代码或者开发过程中的笔记。 使用Flex for JSP,开发者可以: 1. 创建动态、交互性强的用户界面...
2. **PureMVC**:PureMVC不仅仅是一个Flex框架,它也适用于多种面向对象的开发环境,如Java和PHP。其优点是提供了丰富的示例和最佳实践,但学习曲线陡峭,需要开发者具备深厚的团队协作和架构经验。PureMVC的理论化...
Flex与Java交互通讯是Web开发中的一个重要话题,它涉及到客户端与服务器端的高效协同工作。Flex,作为Adobe的开源框架,主要用于构建富互联网应用程序(RIA),而Java则是一种广泛使用的后端开发语言,能提供强大的...