URI Handling and Parameter Handlers

Simple Question, if were using vaadin do we need to create parameter handlers or handle parameters or can we just use the URI Fragment Utility to handle navigation and just load pages dynamically? What is the purpose of both Parameter handling and URI handling?

Hi,

I’ve not used parameter handlers, but we do use URI fragment handling to parametrize views.

This may not be the exact technical low-down, but this is my working understanding:
At a low level, changing the URL by adding parameters forces the entire page to be reloaded/built - but changing the URI fragement doesn’t.

e.g. if you are on http://localhost:8080/app and you navigate to http://localhost:8080/app?view=ShowThing&parameter1=ARef&parameter2=434.2 , this will force the browser to send a complete HTTP GET request to the server, which will lead to the entire GUI being rebuilt in the browser.

If you navigate to http://localhost:8080/app#ShowThing/ARef/434.2, the browser will detect the change and only (essentially) send the #ShowThing/Aref/434.2 to Vaadin serverside.

The net result is a slightly more responsive UI.

HTH a little,

Cheers,

Charles.

If i am using the UriFragmentUtility Object can i set child fragments for example,

http://localhost:8080/app/#admin#childtab#childtab

I see no reason why not, but I’ve never tried it. You can do whatever you like with what’s after the # - it’s just presented to you as a string to parse.

FWIW, I’ve been using / to separate arguments/parameters.

Cheers,

Charles.

Yeah I agree, ‘/’ is a better separator between the keywords than additional ‘#’

Also, I’ve been using the style seen for example in twitter, where the uri fragments starts with “/#/”, which in my opinion makes the url look a little cleaner.
For example: www.coolpage.com/myapp/#/1234/foo/en

Do you have any examples of Vaadin code that does this sort of thing? I would like to see some sort of an example where child elements can be set. By grabbing the current UriFragmentUtility object and setting the fragment again just overrides the current one and does not append or add ‘/’ paths to it?

The last project where I did this is open source and I can show the code for it. However, the project is built on top of Vaadin 7 Alpha 2 so the code is a bit different from the latest stable version of Vaadin (6).

You can find the relevant code
here
. setFragment(boolean) and parseFragment(String) are the relevant methods.