标签:des blog http io ar 使用 sp java on
在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>override protected function createChildren():void {
if(ExternalInterface.available){
endpoint = ExternalInterface.call("getEndopint");
}
super.createChildren();
}[Bindable] private var endpoint:String = "";
<%@ 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>
标签:des blog http io ar 使用 sp java on
原文地址:http://blog.csdn.net/flash8627/article/details/41553381