flex 通过htmlservices链接moss的rest(rest 的get post方式)
发布时间:2020-12-15 03:36:01 所属栏目:百科 来源:网络整理
导读:一:flex debug(调试)——trace() ——moss导入 flex学习:1、flex出现不能使用trace调试语句的问题,控制台无信息输出,这个问题不需要修改安装文件的参量, 只需要下载最新的flashplayer_12_ax_debug即可,在运行时,不能通过Web应用程序进行调试, 而应该
一:flex debug(调试)——trace() ——moss导入 flex学习:1、flex出现不能使用trace调试语句的问题,控制台无信息输出,这个问题不需要修改安装文件的参量, 只需要下载最新的flashplayer_12_ax_debug即可,在运行时,不能通过Web应用程序进行调试, 而应该按F11键进行调试,否则,同样不会输出信息。 ? 工程整合 如果把bin-debug 或者 bin-release 放到liferay的tomcat下面,就完全不用新建portlet了,直接添加功能里, 添加一个bin-debug 或者 bin-release ?/index.html即可(index.html可以省略); 还有一种方法,就是把swf等相关的文件复制到portlet的某一个文件夹下面,这样jsp,html就可以和swf进行通信了 导入moss工程时,普通工程导入即可,build path jar路径更改,再把applicationContext做相应的剪切粘贴; 导入liferay 工程时,首先把工程拷贝到portlets、theme下面,再按liferay 工程导入, build path jar (自己的tomcat/root下)。 ? 二:socket + httpservices 的通行学习 moss 后台服务:@QueryParam("id") String id ?这是通脱http的url传递参数的; @FormParam("id") String id 这是通过表单方式传递参数的;@GET ?@POST方式,是指隐式调用参数还是显示调用参数,即get的参数在浏览器的url中显示。 /** ? ? ?* @author zhangyapeng ? ? ?* @function定位服务浏览器地址栏测试方法—— ? ? ?* @data 2014.06.10 ? ? ?*/ ? ? ? ? @GET ? ? ? ? @Path("/locate") ? ? ? ? @Produces(MediaType.TEXT_PLAIN) ? ? ? ? public String locate2(@QueryParam("id") String id){ ? ? ? ? ? ? ? ? ? ? ? ? Stringcmd = "locate,"+id; ? ? ? ? ? ? flexSocket.sendMessage(cmd); ?? ? ? ? ? ? ? return cmd; ? ? ? ? } ? ? ? ? ? ? ? ? /** ? ? ? ? ?* @author zhangyapeng ? ? ? ? ?* @function定位服务,liferay 调用 ? ? ? ? ?* @data 2014.06.10 ? ? ? ? ?*/ ? ? ? ? @POST ? ? ? ? @Path("/locate") ? ? ? ? @Produces(MediaType.APPLICATION_JSON) ? ? ? ? public void locate(@QueryParam("id") String id){ ? ? ? ? ? ? ? ? ? ? //同上。。。 ? ? ? ? } GET @Path("{contact}") @Produces(MediaType.TEXT_PLAIN) public String getres(@PathParam("contact") String contact) { return "Hello," + contact; } 总之,是(@PathParam("contact") String contact) 还是(@QueryParam("id") String id) 还是@(FormParam("id") String id)跟参数的传递方式有关 是url还是form表单提交; 而这里@GET @POST是指 把查询的结果发送的方式。 三:flex 的httpserviece : 首先声明httpservice 进行声明 <fx:Declarations> ? ? ? ?<!-- 将非可视元素(例如服务、值对象)放在此处 --> ? ?? ? ? ? ?<smt:MyPopup id="myPopup"/> ? ? ? ?<mx:HTTPService id="locateService" ? method = "POST" useProxy="false" ? ?resultFormat="text" ? ? ? ? ? ? ? ? ? ? ? ?fault="onFalutHandler(event)"result="onStemeEventResultHandler(event)"/> ? ? </fx:Declarations> ? 之后,触发send()函数。。。 // 根据id调用locateService(httpservice) ? ? ? ? ? ?private functiongetSmteEventById(id:String):void ? ? ? ? ? ?{ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? locateService.url =baseURL + "/getSmteEventById"; ? ? ? ? ? ? ? locateService.method= "POST"; ? ? ? ? ? ? ? var params:Object = new Object(); ? ? ? ? ? ? ? params.id= id; ? ? ? ? ? ? ? locateService.request= params; ? ? ? ? ? ? ? trace(locateService.url); ? ? ? ? ? ? ? locateService.send(); ? ? ? ? ? ?} ? 所有的url 需要在配置文件中写,,,GridManageWidget.mxml RouteWidget.mxml(路径分析有问题的哦) ?SocketWidget.mxml 在各自的xml中,当然自己也创建了一个CommonURL.xml, 在更改config.xml的对应该即可,config=""的属性值。。 难题—— Search.mxml,是系统自带的,它的Search.xml中有好多图层的url,得自己改的哦。。? ----- 所以现在的解决方法是 ?通过config.xml总的系统配置文件,对应找config=""的属性值,更改各个url的。(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |