A few migration questions v6 - v7

Hi Guys.

I’m looking at migrating our app to Vaadin 7. Most of the port has been straightforward, but there are a few outstanding issues that I can’t seem to find an easy answer to.

  1. Component.getWindow(). Where did this go? What should be used instead? Do I have to call component.getParent(), and then check if thats a window, and if not call getParent() recursively until I find the window?

  2. We have code that loads a property file as a resource stream from the servlet context. This is quite a standard example we found on these forums.

         ApplicationContext ctx = getContext();
         WebApplicationContext webCtx = (WebApplicationContext) ctx;
         ServletContext sc = webCtx.getHttpSession().getServletContext();
         
         InputStream is = sc.getResourceAsStream(value);
    

There is no longer a getContext() on the new UI class, and besides, I cant even see a ServletContext object in the javadoc API anyway. So if you could let me know the vaadin 7 equivalent, it would be greatly appreciated.

Thanks. Vaadin is a truly great product!

Cheers,
Lee.

This was basically changed into getUI and losing the functionality to find a parent sub window. You can use findAncestor to find a parent of any given type, e.g. findAncestor(Window.class) to mimic the behavior of getWindow() for a component in a sub window.

The servlet part has been quite heavily refactored for Vaadin 7. You can get a reference to the Vaadin servlet using VaadinServlet.getCurrent(). Then you have all servlet methods available to use, e.g. getServletContext().

Superb - Thanks very much!