Flex开发中使用Ant编译.mxml成.swf后,在.swf里使用Session的解决方法
关键字: Flex Ant 编译 mxml swf SessionFlex开发中使用Ant编译.mxml成.swf后,在.swf里使用Session的解决方法
http://iamin.blogdriver.com/iamin/1176113.html
Flex Remote Object中直接使用HttpSession的方法在Flex Samples里有Session的操作使用例子:
http://localhost:8080/samples/explorer/misc/ServerSessionDemo.mxml
但是,使用mxmlc编译.mxml成.swf后,在.swf里是没有办法使用Session的
解决办法:可以通过RemoteObject的通讯方式来进行Session的处理
Working with session data
A Java object that you call using the
Method Description
flashgateway.Gateway.getHttpRequest()
Returns the HttpServletRequest object for the current request. Macromedia recommends that you access session data and other request data through the getHttpRequest() method.
flashgateway.Gateway.getHttpResponse()
Returns the HttpServletResponse object for the current request.
flashgateway.Gateway.getServletConfig()
Returns the ServletConfig object for the calling servlet.
To compile calls with these methods in their classes, you must have the WEB-INF/lib/flashgateway.jar file in your classpath.
The following example shows code in a Java class for accessing a session attribute:
String fooAttrib = (String)flashgateway.Gateway.getHttpRequest().getSession().
getAttribute("attr1");
这样,.mxml文件经过编译成.swf后,照样可以进行使用Session了。
- 浏览: 594742 次
- 性别:

- 来自: 福建莆田@广州

- 详细资料
搜索本博客
我的相册
共 146 张
最近加入圈子
链接
- 超越黎明
- CJSDN
- CSDN
- JavaWorld@TW
- JavaEye
- Spring中文论坛
- Matrix
- BEA dev2dev
- Agile Tao Forum
- Flickr
- developerWorks
- TheServerSide
- Sun Java Forum
- JavaRanch
- 满江红开源
- del.icio.us
- Sun中国技术社区
- 希赛网中国软考
- AJAX Design Patterns
- CSS: The Missing Manual
- Java Persistence with Hibernate
- Script in Java
- Building Spring 2 Enterprise Applications
- Tuscany中文社区
- 我爱人开的购物店,欢迎光临
- Beginning Spring 2: From Novice to Professional
- Effective Java Second Edition
最新评论
-
惊人大秘密:中国人必看! ...
怎么没人评价啊~帮你顶下!
-- by ╱/罒呍唲 -
记08.07.19 Beijing OpenP ...
呵呵 是"空军总司令呀". 介绍时在我后面:P 我是"杀手":P
-- by woods -
记08.07.19 Beijing OpenP ...
@dearwolf哈,小刀同学不厚道呀,。。。原来带o6z去制作烟囱去了。。。不 ...
-- by YuLimin -
记08.07.19 Beijing OpenP ...
引用dearwolf 18 小时前恩……o6z当时跑到外面去吸烟了,所以轮到他的 ...
-- by ozzzzzz -
记08.07.19 Beijing OpenP ...
- - 嘿嘿。那香蕉确实很赞! 不过我怀疑是ThoughtWorks员工的。 ...
-- by sg552






评论排行榜