- 浏览: 16804 次
- 性别:
- 来自: 广州
文章分类
最新评论
-
sunwb2009:
你怎么骗哥呢?没jar么!
json-lib运行环境所需的jar包 -
sunwb2009:
非常不错,好!
json-lib运行环境所需的jar包
Over a year ago, SpringSource and Adobe announced a partnership aimed at streamlining the integration between Spring and BlazeDS. This partnership has led to the new Spring BlazeDS Integration project, which allows you to seamlessly integrate the two technologies and build state-of-the-art Internet applications that feature a Flex front end and a Spring back-end. Whether you are a Flex developer just learning Spring or a Spring developer learning Flex, you can benefit from the powerful integration of these technologies. Spring has emerged as the de facto standard for building the Java back-end of Internet applications. Flex is rapidly becoming the preferred technology for building innovative Internet applications delivered in the browser and on the desktop (using the Adobe AIR runtime). This article provides an introduction to the Spring BlazeDS Integration, and includes a simple example application to illustrate key concepts. What is Spring? The foundation of the Spring framework is a lightweight component container that implements the Inversion of Control (IoC) pattern. Using an IoC container, components don't instantiate or even look up their dependencies (the objects they work with). The container is responsible for injecting those dependencies when it creates the components (hence the term "Dependency Injection", which is also used to describe this pattern). By enabling looser coupling between components, the Spring IoC container has proven to be a solid foundation for building robust enterprise applications. The components managed by the Spring IoC container are called Spring beans. In addition to its core IoC container, The Spring framework includes several other modules, including support for transaction management, JDBC Data Access, and ORM Data Access. While these modules are beyond the scope of this article, it is important to note that an additional benefit of using BlazeDS with Spring is the ability to leverage these modules to facilitate the development of your remote objects. More information on the Spring framework can be found here. What is Flex? Flex is a developer toolkit for building Rich Internet Applications. The Flex programming model includes: ActionScript - an ECMAScript-compliant, object-oriented programming language. With some syntactical differences, ActionScript looks and feels similar to Java, and supports the same object-oriented constructs: packages, classes, inheritance, interfaces, strong (but also dynamic) typing, and so on.
MXML - an XML-based language that provides an abstraction on top of ActionScript, and allows parts of an application (typically the View) to be built declaratively.
An extensive set of class libraries. The documentation is available here.
The Flex source code (.mxml and .as files) is compiled into Flash bytecode (.swf) that is executed at the client side by the ActionScriptVirtual Machine in Flash Player using a Just-In-Time compiler. The Flex SDK is an open-source project. It includes the Flex component library, the compiler, the debugger, and the documentation. A complete discussion of Flex is beyond the scope of this article, but you can find more information and download Flex 4 here. What is BlazeDS? BlazeDS is a set of data services that give your Flex applications additional options for data connectivity. Without BlazeDS (or, without deploying any Flex-specific component on the server side), Flex applications can access back-end data using either the HTTPService or WebService components: You use the HTTPService component to send HTTP requests to a server and consume the response. Although the HTTPService is often used to consume XML, it can be used to consume responses in other formats, including JSON. The Flex HTTPService is similar to the XMLHttpRequest component available in Ajax.
You use the WebService component to invoke SOAP-based web services
BlazeDS adds the following services: The Remoting Service allows your Flex application to directly invoke methods of Java objects deployed in your application server.
The Message Service provides a publish/subscribe infrastructure that enables your Flex application to publish messages and subscribe to a messaging destination, enabling the development of real-time data push and collaborative applications.
The Proxy Service allows your Flex application to make cross-domain service requests in a secure and controlled manner. In other words, it allows your Flex application to access a service available on a different domain than the domain from where the application was downloaded (without having to deploy a crossdomain.xml policy file on the target domain).
The Flex source code (.mxml and .as files) is compiled into Flash bytecode (.swf) that is executed at the client side by the ActionScriptVirtual Machine in Flash Player using a Just-In-Time compiler. The Flex SDK is an open-source project. It includes the Flex component library, the compiler, the debugger, and the documentation. A complete discussion of Flex is beyond the scope of this article, but you can find more information and download Flex 4 here. What is BlazeDS?
BlazeDS is a set of data services that give your Flex applications additional options for data connectivity. Without BlazeDS (or, without deploying any Flex-specific component on the server side), Flex applications can access back-end data using either the HTTPService or WebService components: You use the HTTPService component to send HTTP requests to a server and consume the response. Although the HTTPService is often used to consume XML, it can be used to consume responses in other formats, including JSON. The Flex HTTPService is similar to the XMLHttpRequest component available in Ajax.
You use the WebService component to invoke SOAP-based web services.
BlazeDS adds the following services: The Remoting Service allows your Flex application to directly invoke methods of Java objects deployed in your application server.
The Message Service provides a publish/subscribe infrastructure that enables your Flex application to publish messages and subscribe to a messaging destination, enabling the development of real-time data push and collaborative applications.
The Proxy Service allows your Flex application to make cross-domain service requests in a secure and controlled manner. In other words, it allows your Flex application to access a service available on a different domain than the domain from where the application was downloaded (without having to deploy a crossdomain.xml policy file on the target domain).
BlazeDS is deployed as a set of JAR files as part of your web application. Like the Flex SDK, BlazeDS is an open-source project. More information is available here. Accessing Spring Beans from a Flex application
If Flex clients can remotely access Java objects using BlazeDS, and if Spring beans are just regular Java objects, aren't you all set and ready to start accessing Spring beans from Flex clients? Almost… By default, you configure BlazeDS remote objects in a configuration file called remoting-config.xml located in WEB-INF\flex. For example, to make a Java class named ProductService available remotely to a Flex application under the logical name "product", you would define a destination as follows: my.package.ProductService This destination allows a Flex application to invoke the public methods of ProductService. Here is a minimalist Flex application that populates a DataGrid with a list of products obtained by remotely invoking the findAll() method of the ProductService class. flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx"> The problem is that by default, BlazeDS takes care of instantiating and managing the life cycle of the remote objects defined in remoting-config.xml. The whole idea behind Spring IoC, however, is to let the container instantiate components (and inject their dependencies). The key to the integration of Spring and BlazeDS, therefore, is to find the best possible arrangement to leverage the data services provided by BlazeDS while letting the Spring container manage the configuration, instantiation, and life cycle of the remote objects. The old approach: SpringFactory
BlazeDS provides a general purpose integration/pluggability mechanism based on the Factory pattern. You can plug a custom factory in the definition of a destination to delegate the instantiation and life cycle management of the underlying remote object to another subsystem. The role of the factory is to provide ready-to-use instances of objects to BlazeDS instead of letting BlazeDS instantiate those components. To create a factory, you create a class that implements the flex.messaging.FlexFactory interface, and you implement the lookup() method used by BlazeDS to obtain an instance of a remote object. Internally, the lookup() method may construct a new instance, or obtain it from somewhere else. Historically, Adobe has provided a SpringFactory class that provides BlazeDS with fully initialized (dependency-injected) instances of objects obtained from the Spring container. Configuring a destination to delegate the instantiation of a remote object to Spring was a two step process. Register the Spring factory in WEB-INF/flex/services-config.xml:
Configure the destination to use the factory: spring myBean
Although it provides basic integration between BlazeDS and Spring, the factory approach has a number of shortcomings: The "dependency lookup" approach described above is squarely at odds with the Spring "dependency injection" approach. Objects have to be configured twice: once in the BlazeDS remoting-config.xml file and again in the Spring application context file. The overall system configuration is spread over multiple files. BlazeDS is configured in web.xml, and remoting-config.xml, while Spring is configured in its own application context XML file. The integration is limited to basic "remoting" and doesn't cover other important aspects such as security and messaging. The Spring BlazeDS Integration Project
The SpringSource and Adobe partnership is aimed at streamlining the integration between Spring and BlazeDS. This partnership has resulted in a new subproject in the Spring web portfolio: the Spring BlazeDS Integration project. Instead of having two concurrent systems that have their own configuration approach and that communicate in a rudimentary way, the goal of the project is to let Spring manage BlazeDS "the Spring way", just as it manages the other components of an application, and therefore provide a much deeper and cohesive level of integration between the two technologies. The Spring BlazeDS Integration project provides the following features: The MessageBroker, which is the cornerstone of the BlazeDS engine, is configured and bootstrapped as a Spring-managed bean and doesn't need to be configured in web.xml. Flex messages are routed to the MessageBroker through the Spring DispatcherServlet. Remote objects are configured the "Spring way" in the application context configuration file. You don't need a remoting-config.xml file when working with BlazeDS and Spring. Messaging destinations are configured the "Spring way". You don't need a messaging-config.xml file when working with BlazeDS and Spring. The Spring security integration ensures that you can secure Spring-managed beans exposed as remote objects just as you would secure any other Spring-managed endpoint, and that you can provide your security credentials from within a Flex application through the channelSet.login() API. A simple example
To set up a simple Spring BlazeDS Integration application, you will need to: Configure Spring in web.xml.
Configure the BlazeDS message broker as a Spring-managed bean in the application context configuration file.
Configure your beans and expose them as remote objects in the application context configuration file.
Note: Depending on the DispatcherServlet mapping defined in web.xml, you may also need to adjust the default channel configuration in the BlazeDS services-config.xml file. In web.xml, you configure the DispatcherServlet to bootstrap the Spring WebApplicationContext as usual. In this simple configuration, you then map all the /messagebroker requests to the DispatcherServlet. web.xml spring org.springframework.web.servlet.Dispa tcherServlet contextConfigLocation /WEB-INF/web-application-context.xml 1 spring /messagebroker/* In web-application-config.xml, you first configure the BlazeDS message broker as a Spring-managed bean using the simple message-broker tag. This will bootstrap the BlazeDS message broker. When you use the message-broker tag without mapping child elements, all incoming DispatcherServlet requests are mapped to the MessageBroker. You can add mapping child elements if you need more control. With the message-broker in place, you then configure your Spring beans as usual, and you expose the beans you want to make available for remote access using the remoting-destination tag. web-application-config.xml flex="http://www.springframework.org/schema/ flex" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instan ce" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring -beans-3.0.xsd http://www.springframework.org/schema/flex http://www.springframework.org/schema/flex/spring- flex-1.0.xsd"> flex:message-broker/> flex:remoting-destination /> The above configuration allows a Flex application to invoke the public methods of the productService bean. Here is a minimalist Flex application that populates a DataGrid with a list of products obtained by remotely invoking the findAll() method of the ProductService class. flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx"> Note that this is the same code that was used to connect to a plain BlazeDS installation: The client-side code is isolated from the specific server-side implementation. Where to go from here
The Spring BlazeDS Integration project enables you to seamlessly integrate Flex, BlazeDS, and Spring to build expressive, high-performance, and well-architected Rich Internet Applications. If you are already a Spring developer, you can leverage your existing infrastructure and simply expose your beans for remote access by Flex clients via BlazeDS remoting. If you are an existing Flex and BlazeDS developer, you can use Spring BlazeDS Integration to easily leverage the many powerful features of the Spring IoC container and other components of the Spring Framework. The example above was intentionally kept very simple and we only scratched the surface of the Spring BlazeDS Integration. To learn about other features including Messaging and Security integration, read the article Spring BlazeDS Integration Test Drive. The following resources are also helpful: The Spring BlazeDS Integration Project
BlazeDS Open Source Project
Flex SDK Open Source Project
Flash Builder 4 Eclipse Plug-in
发表评论
-
字符串拷贝函数
2012-07-06 09:51 641这次面试腾讯,面试官要我写个字符串拷贝函数,头一天晚上一晚 ... -
用Javascript正则表达式验证Email地址
2012-07-06 09:44 1054用Javascript正则表达式验证Email地址 收 ... -
[转]JavaScript-正则表达式(二)
2012-07-06 09:37 583JavaScript中的正则表达式简介 摘要:对文本数 ... -
时钟
2012-07-06 09:29 571extrn music:far,gensound:far ... -
两款JAVASCRIPT幻灯片
2012-07-05 20:44 738New Document ... -
Xtree组件笔记
2012-07-03 13:42 7371.XTREE简介: XTREE是一个基于AJAX实现 ... -
Xtree组件笔记
2012-07-03 12:16 6941.XTREE简介: XTREE是一个基于AJAX实现 ... -
HR人员基本信息、分配信息和地址信息SQL
2012-07-02 10:13 618人员信息、分配信息和地址信息SQL语句: SELECT p ... -
Firefox/Chrome下flash的wmode参数设为opaque或transparent时输入文本框中无法输入中文汉字的解决方法
2012-07-02 10:13 532这段时间做个项目 ... -
Android AIR 学习(一)
2012-07-02 10:13 669从Android 2.2开始flash ... -
学习Flex,都学些什么
2012-07-01 09:33 463学习Flex,都学些什么呢? 1、首先是事件机制,整 ... -
Flex屏蔽默认右键菜单。
2012-07-01 09:33 623首先需要修改index.template.html生成的静 ... -
Flex DataGrid 控件知识汇总,创建、全选、删除、分页、样式
2012-07-01 09:33 655DataGrid控件是一个可以展示多列数据的列表控件。它是 ... -
Flex操作Json数据示例
2012-07-01 09:33 511Flex操作Json数据示例 本示例中需要用到JSO ... -
几个问题及解决方法
2012-06-30 17:51 918在编译VC 工程时出现的编译错误 问题如下 ... -
Zend Studio 安装后启动报错的解决方法
2012-06-30 17:51 751本文转自:http://www ... -
log4cpp 内存泄漏 解决方法
2012-06-30 17:51 1196以前一直自己写日志类的框架 最近了解了一下开源的,感 ... -
我的嵌入式学习笔记(2)--scanf使用常见问题及解决方法
2012-06-30 17:51 492作者:曹忠明,华清远见嵌入式学院讲师。 在学习C语言 ... -
java.lang.OutOfMemoryError: Java heap space解决方法
2012-06-30 17:51 489//首先检查程序有 ...
相关推荐
Spring BlazeDS Integration 1.0.0
Spring BlazeDS Integration,Flex通过remoteObject与java通讯,附带例子 文档
使用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://depravedangel.iteye.com/blog/883636
NULL 博文链接:https://madfroghe.iteye.com/blog/935337
NULL 博文链接:https://chenhuiggggg.iteye.com/blog/1994009
详解spring BlazeDS 与 flex 集成应用,希望对各位大栳有用
Flex技术本身和Java就有很强的关联性,它提供了一个基于Eclipse的IDE和BlazeDS.BlazeDS是个基于服务端的Java远程调用和Web消息的一个开源的技术。...在2008年末,Spring社区已经着手Spring BlazeDS整合的项目。
Flex Spring BlazeDS整个web工程,其中FlexServer是整合后的myeclipse web project工程,FlexText是Flex测试工程。在tomcat中运行测试无误。
Spring MVC+BlazeDS+Flex框架实践
flex页面源码 博文链接:https://jhaij.iteye.com/blog/832478
Spring BlazeDS Integration
spring+blazeDS+flex4整合的例子,项目可以直接运行,jar包都齐全 模拟数据库返回的list 在页面上 输出
Cool presentation to introduce spring and blazeDS framework.
blazeds4整合spring3 这是我新近研究的方法 与整合spring2.5以下的方法有不同了,(看过一些教程觉得不是很好,用起来不顺手) 最终参考了官方的sample,得到了这个不错的整合方法。 把要用blazeds公开给flex的java...
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