Root path for a GWT application

768 views
Skip to first unread message

David Wery

unread,
May 22, 2012, 8:18:08 AM5/22/12
to google-we...@googlegroups.com
Hi all,

I'm currently building a GWT application but my customer does not want to see anything in the URL path except the domain. For example, I have actually the application deployed on the URL : http://www.foo.com/bar/Bar.html (where bar is the module name) and we actually want only http://www.foo.com.

How to achieve this ?

Thanks a lot for your help.

David

Thomas Broyer

unread,
May 23, 2012, 9:34:20 AM5/23/12
to google-we...@googlegroups.com
Nothing to do with GWT actually, more with your deployment.

Assuming you're use Java on the server too, and deploying as a WAR into something like Tomcat or Jetty, then to remove the '/bar/' context-path, the easiest is to simply rename your war into ROOT.war (for Tomcat) or root.war (for Jetty).

To remove the need for the "Bar.html" part, rename your page as "index.html" or add the following to your web.xml:
<welcome-file-list>
  <welcome-file>Bar.html</welcome-file>
</welcome-file-list>
https://developers.google.com/appengine/docs/java/config/webxml#The_Welcome_File_List (not specific to AppEngine, see the links to the specs at the top of the page)

David Wery

unread,
May 24, 2012, 5:05:15 AM5/24/12
to google-we...@googlegroups.com
Hi Thomas,

Thanks for the answer !

My application is already deployed in the root context of the application server (JBoss 7). The bar in the url seems to be coming for the GWT module name (rename-to section in the GWT.xml file). Is there a way to remove the name of the GWT module ?

David

Thomas Broyer

unread,
May 24, 2012, 5:11:00 AM5/24/12
to google-we...@googlegroups.com


On Thursday, May 24, 2012 11:05:15 AM UTC+2, David Wery wrote:
Hi Thomas,

Thanks for the answer !

My application is already deployed in the root context of the application server (JBoss 7). The bar in the url seems to be coming for the GWT module name (rename-to section in the GWT.xml file). Is there a way to remove the name of the GWT module ?

No, but you don't have to put your Bar.html into your GWT module's 'public' path (that layout dates back to the GWT 1.5 era, that's 3 years old!)

David Wery

unread,
May 24, 2012, 5:14:04 AM5/24/12
to google-we...@googlegroups.com
Ah, indeed I have the Bar.html in the resources folder (src/main/resources). This is not the right way to manage it ?

Thomas Broyer

unread,
May 24, 2012, 5:30:47 AM5/24/12
to google-we...@googlegroups.com


On Thursday, May 24, 2012 11:14:04 AM UTC+2, David Wery wrote:
Ah, indeed I have the Bar.html in the resources folder (src/main/resources). This is not the right way to manage it ?

Put it in src/main/webapp and change your <script>'s src="" accordingly (from src="bar.nocache.js" to src="bar/bar.nocache.js")
Reply all
Reply to author
Forward
0 new messages