flex动态设置RemoteObject endpoing
2014-11-27 20:56
417 查看
在flex开发中经常碰到用户部署项目时跟开发时的项目名称不一样.但flex是编译时生成的endpoing,换个名称部署项目flex就不能访问服务.
解决办法:
使用jsp获取当前项目名及路径.使用flex调用js的方法,获取项目的路径及名称.修改endpoint
具体源码如下:
Flex:
<s:RemoteObject id="IndexServicesController" destination="IndexServicesController" fault="httpServiceFault(event)"
endpoint="{endpoint}/messagebroker/amf">
<s:method name="getSysMenu" result="getSysMenuResultHandler(event)" />
</s:RemoteObject>
JSP:
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
解决办法:
使用jsp获取当前项目名及路径.使用flex调用js的方法,获取项目的路径及名称.修改endpoint
具体源码如下:
Flex:
<s:RemoteObject id="IndexServicesController" destination="IndexServicesController" fault="httpServiceFault(event)"
endpoint="{endpoint}/messagebroker/amf">
<s:method name="getSysMenu" result="getSysMenuResultHandler(event)" />
</s:RemoteObject>
override protected function createChildren():void { if(ExternalInterface.available){ endpoint = ExternalInterface.call("getEndopint"); } super.createChildren(); }
[Bindable] private var endpoint:String = "";
JSP:
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<script type="text/javascript"> function getEndopint() { return "<%=basePath%>"; } </script>
相关文章推荐
- FLEX与.NET通信:WebService与RemoteObject连接地址的动态确定
- flex4 RemoteObject 动态调用 java 代码
- ASP .Net 如何动态设置ObjectDataSource 的 SelectParameters
- 在Flex中动态设置icon属性
- 如何使用Flex RemoteObject components(含java/flex类之间的转换)TESTED
- Flex动态设置Button中的icon指向外网图片源
- flex:RemoteObject 和 DataGrid 数据交互, AS 与java 数据类型转换
- Flex RemoteObject 简单应用Demo
- Flex与服务器交互之四(使用RemoteObject +BlazeDS+TomCat同Java交互及开发环境配置)
- Flex RemoteObject and AMFPHP1.9教程
- Flex Remote Object中直接使用HttpSession的方法
- Flex远程调用机制RemoteObject应用技巧(转)
- FLEX-ComboBox绑定JAVA返回的数据源(RemoteObject)
- 使用ArcGIS Server怎么动态设置Host和MapServerObject属性
- flex的remoteobject方式调用java的方法
- Flex RemoteObject and AMFPHP 1.9 教程
- flex httpservice vs Remote object 优点
- FLEX权限--使用RemoteObject交互结合spring AOP控制项目权限教程
- Java+Flex整合应用简单示例 (mx:RemoteObject)
- Flex button icon动态设置