diff options
author | Erik Lumme <erik@vaadin.com> | 2017-09-12 10:48:59 +0300 |
---|---|---|
committer | Erik Lumme <erik@vaadin.com> | 2017-09-12 10:48:59 +0300 |
commit | 84e702dacadecb38815a6b43afff8d4609349a6b (patch) | |
tree | 1fb133ece1ca8a363559b4237c6553fd6b63b6ba /documentation | |
parent | b1f39f53eec0bbb3258930c6c222a7c1a75cc936 (diff) | |
download | vaadin-framework-84e702dacadecb38815a6b43afff8d4609349a6b.tar.gz vaadin-framework-84e702dacadecb38815a6b43afff8d4609349a6b.zip |
Migrate VaadinOnGrailsMultipleUIs
Diffstat (limited to 'documentation')
-rw-r--r-- | documentation/articles/VaadinOnGrailsMultipleUIs.asciidoc | 52 | ||||
-rw-r--r-- | documentation/articles/contents.asciidoc | 1 |
2 files changed, 53 insertions, 0 deletions
diff --git a/documentation/articles/VaadinOnGrailsMultipleUIs.asciidoc b/documentation/articles/VaadinOnGrailsMultipleUIs.asciidoc new file mode 100644 index 0000000000..3e42e650e3 --- /dev/null +++ b/documentation/articles/VaadinOnGrailsMultipleUIs.asciidoc @@ -0,0 +1,52 @@ +[[vaadin-on-grails-multiple-uis]] +Vaadin on grails - multiple UIs +------------------------------- + +_Versions used in this tutorial: Grails 2.3.x, Vaadin 7.1.x. News and +updates about Vaadin on Grails are available on +https://twitter.com/VaadinOnGrails[VaadinOnGrails]. This is continuation +of link:VaadinOnGrailsDatabaseAccess.asciidoc[Vaadin on Grails - Database access]_ + +In `grails-app/conf/VaadinConfig.groovy`, we can change URL mapping to +UI. Also, we can define multiple UIs to be accessible from one Grails +application. + +Create two new UIs that we will show under different URLs. `ClientUI` +will be available on http://localhost:8080/client and `ServerUI` on +http://localhost:8080/server + +[source,java] +.... +class ClientUI extends UI { + protected void init(VaadinRequest request) { + VerticalLayout layout = new VerticalLayout() + layout.setMargin(true) + Label label = new Label("Client") + layout.addComponent(label) + setContent(layout) + } +} + +class ServerUI extends UI { + protected void init(VaadinRequest request) { + VerticalLayout layout = new VerticalLayout() + layout.setMargin(true) + Label label = new Label("Server") + layout.addComponent(label) setContent(layout) + } +} +.... + +Open `VaadinConfig.groovy` and change the mapping, so the mapping points +to the new UIs. + +.... +mapping = +[ "/client/*": "app.ClientUI", + "/server/*": "app.ServerUI"] +.... + +Now we can start up the application and access both URLs to see each is +mapped to different UI class. + +image:http://vaadinongrails.com/img/mapping-uis.png[Mapping UIs] diff --git a/documentation/articles/contents.asciidoc b/documentation/articles/contents.asciidoc index 11c965dcee..d8b62de75e 100644 --- a/documentation/articles/contents.asciidoc +++ b/documentation/articles/contents.asciidoc @@ -43,3 +43,4 @@ are great, too. - link:IntegrationExperiences.asciidoc[Integration experiences] - link:VaadinOnGrailsCreateProjectInIntelliJIDEA.asciidoc[Vaadin on grails - Create project in IntelliJ IDEA] - link:VaadinOnGrailsDatabaseAccess.asciidoc[Vaadin on grails - Database access] +- link:VaadinOnGrailsMultipleUIs.asciidoc[Vaadin on grails - Multiple UIs] |