Using root URL for Vaadin app
Example code is available on github.com/vaadin-on-grails/rest-with-root.
URL mapping can be done also in way we use /
root URL to display Vaadin application. In this article, we are going to show how to do it.
Step 1
Create mapping in UrlMapping.groovy
as follows:
Step 2
Then we need to create the controller that will redirect the request to the Vaadin application.
Step 3
Last step is to make sure that VaadinConfig.groovy contains mapping to Vaadin UI class.
Step 4
Create a controller and implement some logic there. For example, fetch some data from database and return it as JSON.
Step 5
Create two sample Vaadin UI, so we can verify URL mapping.
Step 6
Start up the application and try out these URLs:
http://localhost:8080/rest-with-root redirects user to application
http://localhost:8080/rest-with-root/rest/item displays JSON response
Last updated