SetLocation () from UI.init () method

Is it possible to use getPage (). setLocation (...) from the init () method of the user interface. Under certain conditions, I have to redirect the user to an external site. While this does not work (Vaadin 7.0.2).

Here is a sample code:

@Override public void init(VaadinRequest request) { if (myCondition) getPage().setLocation("http://www.externalsite.com"); else { .... } } 
+4
source share
3 answers

Found my problem. I used the old version of WidgetSet, which was left from 6.X times and was not compiled with Vaadin 7. After I fixed it, everything works fine.

0
source

It is strange that it does not work for you ... setLocation is all you need. Here is the working version: VaadinLocationRedirect . mvn package build the widget, mvn jetty:run will place it. Let us know what the problem is if you find out.

+1
source

It looks like you can call the open( URL ) method of the Window object to open another URL in the same or a new browser window to achieve redirection to an external site.

Alternatively, you can set the exit URL for the application by calling application.setExitUrl() , and then close the application by calling application.close() - your application session will be closed and the browser will be redirected to the specified address.

-1
source

All Articles