- 浏览: 670147 次
- 性别:
- 来自: 珠海
文章分类
最新评论
-
qq826928141:
longxing898 写道请教:使用jtds连接sql 20 ...
rapid-framework v3.9新版本发布 -
qq826928141:
美味人间 写道大哥,这个代码生成器怎么无法获取表和列的备注信息 ...
rapid-framework v3.9新版本发布 -
walle1027:
能发一下的测试代码吗?
rabbitmq性能测试 -
在世界的中心呼喚愛:
好东西,我就是参考这个!!!
iBatis3基于方言(Dialect)的分页 -
暂不存在:
怎么将{key}中的值替换掉
rapid系列:发布一款动态构造sql的工具: XsqlBuilder
注:后面使用SBI替代Spring BlazeDS Integration
1.介绍:
为了使flex客户端能够直接调用服务端的spring bean,SBI提供的此种功能,SBI使用DispatchServlet代理转发MessageBrokerServlet的请求,增加了一些无用的类及相关配置,
而其实完成相同的功能,最简只需两个类即可.
2.扩展实现
BlazeDS本身提供一个AbstractBootstrapService的类用于扩展,该类主要是在BlazeDS初始化时用于动态创建 services, destinations, and adapters. rapid扩展了该类,用于将spring applicationContext的bean自动导出为destination,以供flex客户端调用. SpringRemotingDestinationBootstrapService 自动导出包含"@RemoteObject标注及以FlexService结尾"的Spring Bean为RemotingDestination
public class SpringRemotingDestinationBootstrapService extends AbstractBootstrapService { public static final String DEFAULT_INCLUDE_END_WITH_BEANS = "FlexService"; private String destChannel; private String destSecurityConstraint; private String destScope; private String destAdapter; private String destFactory; private String serviceId; private String includeEndsWithBeans; public void initialize(String id, ConfigMap properties) { serviceId = properties.getPropertyAsString("service-id", "remoting-service"); destFactory = properties.getPropertyAsString("dest-factory", "spring"); destAdapter = properties.getProperty("dest-adapter"); destScope = properties.getProperty("dest-scope"); destSecurityConstraint = properties.getProperty("dest-security-constraint"); destChannel = properties.getPropertyAsString("dest-channel","my-amf"); includeEndsWithBeans = properties.getPropertyAsString("includeEndsWithBeans",DEFAULT_INCLUDE_END_WITH_BEANS); Service remotingService = broker.getService(serviceId); if(remotingService == null) { throw createServiceException("not found Service with serviceId:"+serviceId); } createSpringDestinations(remotingService); } private ServiceException createServiceException(String message) { ServiceException ex = new ServiceException(); ex.setMessage(message); return ex; } private void createSpringDestinations(Service remotingService) { WebApplicationContext wac = WebApplicationContextUtils.getWebApplicationContext(broker.getInitServletContext()); List<String> addedBeanNames = new ArrayList(); for(String beanName : wac.getBeanDefinitionNames()) { Class type = wac.getType(beanName); boolean isCreateSpringDestination = type.isAnnotationPresent(RemotingObject.class) || beanName.endsWith(includeEndsWithBeans) || isCreateDestination(beanName,type); if(isCreateSpringDestination) { createSpringDestination(remotingService, beanName); addedBeanNames.add(beanName); } } System.out.println("[Auto Export Spring to RemotingDestination],beanNames="+addedBeanNames); } protected boolean isCreateDestination(String beanName,Class type) { return false; } /* <!-- 动态生成的配置内容 --> <destination id="sampleVerbose"> <channels> <channel ref="my-secure-amf" /> </channels> <adapter ref="java-object" /> <security> <security-constraint ref="sample-users" /> </security> <properties> <source>my.company.SampleService</source> <scope>session</scope> <factory>myJavaFactory</factory> </properties> </destination> */ protected void createSpringDestination(Service service, String destinationId) { flex.messaging.services.remoting.RemotingDestination destination = (flex.messaging.services.remoting.RemotingDestination)service.createDestination(destinationId); destination.setSource(destinationId); destination.setFactory(destFactory); if(destAdapter != null) destination.createAdapter(destAdapter); if(destScope != null) destination.setScope(destScope); if(destSecurityConstraint != null) destination.setSecurityConstraint(destSecurityConstraint); if(destChannel != null) destination.addChannel(destChannel); service.addDestination(destination); } }
3.配置
将该类与网上的SpringFactory结合,即可使用. 以下为service-config.xml中关于自动导出的配置.
<!-- 创建Spring RemotingDestination使用,与spring-remoting-service配合使用 --> <factories> <factory id="spring" class="cn.org.rapid_framework.flex.messaging.factories.SpringFactory"/> </factories> <services> <service-include file-path="remoting-config.xml" /> <service-include file-path="proxy-config.xml" /> <service-include file-path="messaging-config.xml" /> <!-- 自动导出包含"@RemoteObject标注及以FlexService结尾"的Spring Bean为RemotingDestination FlexService结尾可以通过includeEndsWithBeans变量指定 --> <service id="spring-remoting-service" class="cn.org.rapid_framework.flex.messaging.services.SpringRemotingDestinationBootstrapService"> <!-- 其它生成的RemotingDestination默认属性 --> <properties> <!-- <service-id></service-id> <dest-factory></dest-factory> <dest-adapter></dest-adapter> <dest-scope></dest-scope> <dest-channel></dest-channel> <dest-security-constraint></dest-security-constraint> <includeEndsWithBeans></includeEndsWithBeans> --> </properties> </service> </services>
4.flex客户端调用
//简单示例调用 this.blogFlexService = new RemoteObject("blogFlexService"); //这里需要指定endpoint,因为是动态的RemotingDestination,而静态的RemotingDestination ,flex编译器会将endpoint编译进源代码. //这个也是flex编译器需要指定配置文件而导致使用flex经常会犯的错误之一. this.blogFlexService.endpoint = '../messagebroker/amf';
5.结论
与SBI相比,更加简单即可完成相同功能。并且通过AbstractBootstrapService,你可以很容易的完成将Java Bean, Or EJB3的session bean导出为destinations以供flex客户端直接调用.
具体使用请下载rapidframework并查看flex插件
rapid官方网站: http://www.rapid-framework.org.cn
评论
3 楼
fhjxp
2010-02-22
正确的配置导致错误的结果,一个正确的配置没办法使用
2 楼
badqiu
2010-02-22
你在后台应该可以看到:
[Auto Export Spring to RemotingDestination],beanNames=[userInfoFlexService]
这样就证明你的配置正确,就可以直接调用userInfoFlexService了。
[Auto Export Spring to RemotingDestination],beanNames=[userInfoFlexService]
这样就证明你的配置正确,就可以直接调用userInfoFlexService了。
1 楼
fhjxp
2010-02-22
为什么我按照这样做后老出现错误提示:xxx not availabel in the specified
发表评论
-
rapid-framework v3.9新版本发布
2010-07-13 21:17 13427hi,all 本次新版本发布最主要的更新内容 ... -
为velocity,freemarker提供jsp:include功能
2010-06-13 19:26 11420一.介绍 使用JSP的都知道jsp:include指令,可以 ... -
rapid-framework发布新版本: v3.5
2010-03-23 19:01 4472本次的主要更新内容是重新拾起flex,重整了flex插件. 而 ... -
扩展freemarker,velocity,实现模板的管道操作
2010-01-12 20:54 4608操作系统中有一个很重要的功能,就是可以使用管道,即将前一个应用 ... -
扩展Velocity,实现模板的继承
2009-12-28 12:00 5502与我之前的扩展freemarker类似,现新增加三个指令:bl ... -
扩展freemarker,实现模板的继承
2009-12-22 10:11 9212现扩展freemarker,新增加三个指令: @ ... -
spring REST中的内容协商(同一资源,多种展现:xml,json,html)
2009-12-21 14:14 21730接上一篇对spring rest的描述. ... -
在jsp中实现"类"的继承关系
2009-12-09 17:59 72371.介绍 使用过python django模板 ... -
rapid-framework发布v3.0 版本
2009-11-11 09:46 4919虽然spring 3.0及ibatis3还未发布,但rap ... -
iBatis3基于方言(Dialect)的分页
2009-10-19 09:29 23776(注:以下代码是基于ibatis3 beta4的扩展,ibat ... -
rapid-framework发布v2.5.0版本
2009-09-21 09:54 2259赶在国庆之前发布一个版本,庆祝国庆,:) 更新内 ... -
rapid-framework工具类介绍一: 异步IO类
2009-05-08 01:16 2208在一些特殊的场合,我们可能需要使用异步的IO来大幅提高性能. ... -
rapid-validation发布v1.5版本
2008-12-09 11:44 8173在线演示:http://www.rapid-framework ... -
rapid-framework v2.x路线图
2008-09-09 20:43 2677在1.0.2发布以后,很多同学认为切换至struts2 ... -
rapid-framework v1.0.x带控制条的演示视频放出
2008-08-20 13:28 2003很多同学报怨rapid-framework的演示视频太快,现在 ... -
rapid-framework发布v1.0.2版本
2008-08-13 11:39 2658该版本主要增加的相关文档导航,及一些模板及目录的调整 在线文档 ... -
动态构造sql利器:rapid-xsqlbuider 详细说明
2008-08-06 09:07 5014特性列表: 动态构造sql条件语句,提供sql拼接与使用占 ... -
很高兴大家下载rapid-framework
2008-08-04 11:42 7167看到有很多人下载,心情蛮爽的,这个就是做开源最高兴的吧. 大家 ... -
正式发布类似rails的框架:rapid-framework,文档补充中...
2008-07-29 09:11 5110基于spring,struts(struts2),hibe ... -
最适合实际开发需要的:<代码生成器>发布:rapid-generator-v1.0
2008-07-22 09:05 4262现阶段内置模板可以生成的包括: 可以生成java的hibern ...
相关推荐
Spring BlazeDS Integration,Flex通过remoteObject与java通讯,附带例子 文档
Spring BlazeDS Integration 1.0.0
使用flex 4.5 + Spring 3.0 + Hibernate 3.3 + Cairngorm 2.2.1 + BlazeDS 3.3.0 + Spring BlazeDS Integration 1.0.3整合出的一个登录的小demo·
Java 服务器端技术Spring BlazeDS Integration.docx,看了启示很多
NULL 博文链接:https://madfroghe.iteye.com/blog/935337
NULL 博文链接:https://depravedangel.iteye.com/blog/883636
NULL 博文链接:https://chenhuiggggg.iteye.com/blog/1994009
Flex技术本身和Java就有很强的关联性,它提供了一个基于Eclipse的IDE和BlazeDS.BlazeDS是个基于服务端的Java远程调用和Web消息的一个开源的技术。有许多应用都是以Java为后端处理的。Flex用于前端。由于Java和Flex...
blazeds4整合spring3 这是我新近研究的方法 与整合spring2.5以下的方法有不同了,(看过一些教程觉得不是很好,用起来不顺手) 最终参考了官方的sample,得到了这个不错的整合方法。 把要用blazeds公开给flex的java...
详解spring BlazeDS 与 flex 集成应用,希望对各位大栳有用
Spring MVC+BlazeDS+Flex框架实践
Flex Spring BlazeDS整个web工程,其中FlexServer是整合后的myeclipse web project工程,FlexText是Flex测试工程。在tomcat中运行测试无误。
flex使用blazeds与java通信配置说明,包括java使用spring框架,blazeds调用spring bean
spring+blazeDS+flex4整合的例子,项目可以直接运行,jar包都齐全 模拟数据库返回的list 在页面上 输出
flex页面源码 博文链接:https://jhaij.iteye.com/blog/832478
Flex+blazeDS+Spring官方Demo,环境搭建,内含十几个例子,从易到难,包括spring消息,spring安全,注解方式和非注解配置文件方式,十分好用。内含有tomcat,可直接启动并运行用户手册。
Flex blazeds-spring Flex blazeds-spring Flex blazeds-spring Flex blazeds-spring Flex blazeds-spring Flex blazeds-spring
blazeds与spring的结合使用项目源码