问题描述
我使用Glassfish 3.1.1以开发模式运行GWT应用程序(使用-noserver参数启动)。
当我调用 GWT.getModuleBaseURL()
时,会返回以下URL: http :// localhost:8080 / appName / appName /
正确的URL应该是 http:// localhost: 8080 / APPNAME /
。我想知道我做错了什么,以便应用程序名称被追加两次。
顺便说一下, GWT.getHostPageBaseURL();
返回正确的URL。
http:// localhost:8080 / appName
启动应用程序,那是主机页面,但如果您查看萤火虫或其他检查器,您可能会看到请求 http:// localhost:8080 / appName / appName / appName.nocache.js
这是引导JS文件。它是包含模块基址指向的目录。 I am running a GWT application in development mode out of Glassfish 3.1.1 (launched with a -noserver argument).
When I call GWT.getModuleBaseURL()
, the following URL is returned: http://localhost:8080/appName/appName/
The correct URL should be http://localhost:8080/appName/
. I wonder what I did wrong, so that the application name is appended twice.
By the way, GWT.getHostPageBaseURL();
returns the correct URL.
Your comment is spot on - that is what getModuleBaseURL() does, it returns the path to inside the compiled module, where the generated JavaScript and images are stored. If you launch the app from the url http://localhost:8080/appName
, that is the host page, but if you look in firebug or another inspector, you probably see a request for http://localhost:8080/appName/appName/appName.nocache.js
which is the bootstrap JS file. It is the directory where that is contained that the module base url refers to.
这篇关于GWT.getModuleBaseURL()返回一个不正确的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!