In my application I would like to have “deep link” link, which will contain the information about the currently opened application form and data on that form (basically, a set of parameters, like “form=X&email=abc&user=12”). By navigating to this link the application should show the given form and load the appropriate data. And main questions here:
How to create such URL and embed all needed parameters? I obviously can’t associate the parameters using
AbstractComponent.setData() , because the link will be opened in another session.
How to handle it if the user follows the URL in new browser session and retrieve all needed parameters to fill the form?
How to reset the URL in browser, after the user navigates away from the given from? (so the browser URL does not contain the “stale” information)
You can use regular URL parameters and after getting them, jump to the same URL without the parameters with mainWindow.open(). It causes reloading the page, so it’s rather heavy operation.
Unfortunately, does not work for me out-of-the-box: I have created
UriFragmentUtility class instance and registered it in main window. When I invoke
uriFragmentUtility.setFragment(“openIndexedText”) the URL in browser does not change. Do I miss something here?
Also what mothers me, is that I cant pass any symbol to URL fragment (e.g. “document=2&tab=1”). Or
UriFragmentUtility will encode/decode that for me automatically? Anyway the URL will not be so readable, as if I pass the navigation information in main URL part.
I tried to code a simple application with
UriFragmentUtility , but I think to miss some basics…
I have created the class field,
uriFragmentUtility , registered it in
mainWindow and then I am changing the fragment on button click event: nothing happens. I expect that URL in the browser should be updated… Maybe there is an working code in Vaadin sampler to play with (I failed to find one)? There is no magic in
Vaadin book example , should work…
UriFragmentUtility uriFragmentUtility = new UriFragmentUtility();
...
mainWindow.addComponent(uriFragmentUtility);
...
/**
* @see com.vaadin.ui.Button.ClickListener#buttonClick(com.vaadin.ui.Button.ClickEvent)
*/
public void buttonClick(Button.ClickEvent event) {
uriFragmentUtility.setFragment("openText");
}