GWT.getModuleBaseURL()返回一个不正确的值 [英] GWT.getModuleBaseURL() returns an incorrect value

查看:173
本文介绍了GWT.getModuleBaseURL()返回一个不正确的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Glassfish 3.1.1以开发模式运行GWT应用程序(使用-noserver参数启动)。



当我调用 GWT.getModuleBaseURL()时,会返回以下URL: http :// localhost:8080 / appName / appName /



正确的URL应该是 http:// localhost: 8080 / APPNAME / 。我想知道我做错了什么,以便应用程序名称被追加两次。

顺便说一下, GWT.getHostPageBaseURL(); 返回正确的URL。

$ b $这是getModuleBaseURL()所做的,它返回到编译模块内部的路径,其中生成的JavaScript和图像存储在该模块中。如果您从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()返回一个不正确的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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