Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
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 "acme.com"
• Vaadin app name is "AcmeInvoices"
When use Eclipse Indigo feature to export (File > Export > Web > WAR file), I use the default name. In this case, "AcmeInvoices.war".
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 "AcmeInvoices.war" file to "invoices.war".
 Start Tomcat, letting it auto-deploy the app.
 Note the newly created folder "invoices".
 Test the app using the new URL, http://www.acme.com/invoices/
Similarly, if you want the URL:
…just rename your AcmeInvoices.war file to "app.war" 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?
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:
asadmin deploy --contextroot /foo bar.war
...will deploy the application at http://example.com/foo instead of http://example.com/bar. If you're only ever running one application on a server, then you could also deploy it to / so that the URL is simply http://example.com with no other information.