Redirect to ExternalResource

Hi!

I have some problems with redirect between ExtRes.

First. How can redirect to MainWindow after some redirects between windows?
getApplication().getMainWindow().getWindow().open(new ExternalResource(getApplication().getMainWindow().getURL()), “_self”) - not work.
Where I have made a mistake?

Second. How can redirect to .pdf or jpg file in my project?

Thanks!

Could you make the question clearer? If you are trying to make the user download the file, then use “_blank”

You can redirect to images and pdf the following way:

[code]
getMainWindow().open(new ExternalResource(“http://www.cartinafinland.fi/fi/imagebank/image/31/31045/Hirvas+ja+vaadin+31045.jpg”));

[/code] Note that the “_self” is implicit and not needed. Important thing is that you should call the open method on a window that is currently visible it to work.

To redirect to a resource in a file you can use the
FileResource
or
StreamResource
instead of ExternalResource. For more information about resources take a look at
vaadin.com/book/-/page/application.resources.html

To redirect back to a window is little bit different thing. Mostly you can just change the window instance by using
Application.setMainWindow
. See this for more info:
vaadin.com/book/-/page/application.windows.html