GWT与-noserver [英] GWT with -noserver

查看:103
本文介绍了GWT与-noserver的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作一个使用PHP连接到DB2数据库的GWT项目。当我编译项目并将其部署到服务器(复制WAR目录的内容)时,它工作正常,显然在托管模式下我遇到了SOP问题,因为GWT在端口8888上,而php脚本在端口上运行80.

我试图让-noserver选项正常工作,但我必须缺少一些东西..我回去并从命令行创建基本示例应用程序(webApplicationCreator -out / home / mike / gwt / sample1)
我编辑了build.xml以包含-noserver和-port 80对于devmode的争论。我希望我的应用程序位于localhost / sample1,因此我将-startupUrl编辑为我想要使用的整个URL: http://localhost/sample1/sample1.html



我编译了(ant),从战争中的sample1.html,sample1.css复制到webserver sample1目录以及GWT文档(无历史记录)中介绍的(md5).gwt.rpc,clear.cache.gif,sample1.nocache.js和hosted.html文件从war / sample1复制到sample1 / sample1目录。 html文件被创建)。
然后从项目目录(/ home / mike / gwt / sample1)运行ant devmode
我可以进入sample1.html页面,但是当我点击按钮将名称发送到服务器它返回


远程过程调用 - 失败

服务器回复:
尝试联系服务器时发生错误。请检查您的网络连接,然后再试一次。


我打开了萤火虫,并且它返回一个404为 http:// localhost / sample1 / sample1 / greet 。这是我卡在哪里..这个文件显然不存在我的网络服务器..但为什么?这不是应该由GWT编译的吗?



任何人都可以帮我一把吗?因此,基本上你已经拷贝了客户端/服务器应用程序的客户端。当您的GWT客户端应用程序尝试将远程过程调用(RPC)发送到作为初始样本一部分的问候服务的服务器时,它无法找到该服务。



如果您想复制该服务,则需要有一个Java应用程序服务器,复制GreetingService,引用它的web.xml以及可能的其他一些内容(我必须更多地登录详情)。这听起来并不像你真正想要的,所以你要么在PHP中构建一个响应该URL的GWT-RPC服务,要么删除GWT代码中的引用,以便RPC调用问候服务。 p>

对于PHP后端,您可能不会使用GWT-RPC,我猜测您更可能使用JSON或XML,如果情况就是这样,那么我现在就要去掉RPC调用。



这是否有意义?请随时要求进一步澄清。


I'm making a GWT project that uses PHP to connect to a DB2 database. When I compile the project and deploy it to the server (copy the contents of the WAR directory over), it works fine, obviously in hosted mode I run into the SOP issue since GWT is on port 8888 while the php script is running on port 80.

I'm trying to get the -noserver option to work but I must be missing something.. I went back and created the basic sample app from the command line (webApplicationCreator -out /home/mike/gwt/sample1) I edited the build.xml to include the -noserver and -port 80 arguements for devmode. I want my app to be hosted at localhost/sample1 so I edited the -startupUrl to the whole URL I want to use: http://localhost/sample1/sample1.html

I compiled (ant), copied over the sample1.html, sample1.css from war to the webserver sample1 directory, and the (md5).gwt.rpc, clear.cache.gif, sample1.nocache.js and hosted.html files from the war/sample1 to sample1/sample1 directory as described in the GWT documentation (no history.html file was created). I then run ant devmode from the project directory (/home/mike/gwt/sample1) I can get to the sample1.html page, but when I click the button to send the name to the server it returns with

Remote Procedure Call - Failure

Server replies: An error occurred while attempting to contact the server. Please check your network connection and try again.

I turned on firebug and it's returning a 404 for http://localhost/sample1/sample1/greet. This is where I'm stuck.. this file obviously doesn't exist on my webserver.. but why? Isn't this something that is supposed to be getting compiled by GWT?

Can anyone give me a hand? Thanks!

解决方案

So, basically you've copied over the client-side of a client/server application. When your GWT client application attempts to make a Remote Procedure Call (RPC) to the server to a greeting service that is part of the initial sample, it can't find that service.

If you wanted to copy that service over, you'd need to have a Java application server, copy over the GreetingService, the web.xml that references it and possibly a few other things (I'd have to check in more detail). That doesn't sound like what you actually want, so either you'll want to build a GWT-RPC service in PHP that responds to that URL, or remove the reference in the GWT code to RPC call to the greeting service.

With a PHP back-end, you're probably not going to use GWT-RPC, I'm guessing that you're more likely to use JSON or XML, and if that's the case, then I'd go with removing the RPC call altogether for now.

Does this all make sense? Feel free to ask for further clarification.

这篇关于GWT与-noserver的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆