How to change context root of URL --> Rename WAR file

After many hours of research over many days, I have found an utterly simple way to change the URL used to access a Vaadin app:

Rename the WAR file

• Domain is "
• Vaadin app name is "

When use Eclipse Indigo feature to export (
File > Export > Web > WAR file)
, I use the default name. In this case, "

I move that war file to Tomcat 7, start Tomcat, and Tomcat auto-deploys the app including expanding the war file back to a folder.

Then I can reach the app using this URL:

But what if I want a simpler URL such as this:

To make that my URL:
On my deployment server, shutdown Tomcat.
Delete the folder expanded from the WAR file.
Rename the "
" file to "
Start Tomcat, letting it auto-deploy the app.
Note the newly created folder "
Test the app using the new URL,

Similarly, if you want the URL:

…just rename your
file to "
" when deploying.

At first thought, this seemed so simple and easy that I suspected that I must be “cheating”. But on second thought, this seems perfectly legitimate. Is it?

–Basil Bourque

Yes, It’s perfectly legitimate if you are allowing Tomcat to automatically deploy your webapplications.

You can also explicitly configure tomcat (via XML configuration) to deploy a war/directory to any context name you like.

The choice is yours.

What Charles says is correct: the context root equals the war file name unless you do something to change it.

With many application servers (and there’s probably some way to do this with Tomcat as well), you can also set the context root at deployment time. For instance, a GlassFish deployment like this:

…will deploy the application at instead of If you’re only ever running one application on a server, then you could also deploy it to / so that the URL is simply with no other information.