diff options
author | Leif Åstrand <leif@vaadin.com> | 2011-11-18 15:05:26 +0200 |
---|---|---|
committer | Leif Åstrand <leif@vaadin.com> | 2011-11-18 15:05:26 +0200 |
commit | 126dabf03cff4145463f3421ecb02efe273d23a9 (patch) | |
tree | d6a66624622b7eeac73a9b13401fe4c717ce04c7 /src | |
parent | 95c7681f6505967bde2993911698158d46c99324 (diff) | |
download | vaadin-framework-126dabf03cff4145463f3421ecb02efe273d23a9.tar.gz vaadin-framework-126dabf03cff4145463f3421ecb02efe273d23a9.zip |
Make ApplicationRunnerServlet work with Root classes
Diffstat (limited to 'src')
-rw-r--r-- | src/com/vaadin/terminal/gwt/server/ApplicationRunnerServlet.java | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/com/vaadin/terminal/gwt/server/ApplicationRunnerServlet.java b/src/com/vaadin/terminal/gwt/server/ApplicationRunnerServlet.java index ffc5d8cfc7..628cbed884 100644 --- a/src/com/vaadin/terminal/gwt/server/ApplicationRunnerServlet.java +++ b/src/com/vaadin/terminal/gwt/server/ApplicationRunnerServlet.java @@ -15,6 +15,8 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.vaadin.Application; +import com.vaadin.terminal.WrappedRequest; +import com.vaadin.ui.Root; @SuppressWarnings("serial") public class ApplicationRunnerServlet extends AbstractApplicationServlet { @@ -65,7 +67,18 @@ public class ApplicationRunnerServlet extends AbstractApplicationServlet { // Creates a new application instance try { - final Application application = getApplicationClass().newInstance(); + final Class<? extends Application> applicationClass = getApplicationClass(); + if (Root.class.isAssignableFrom(applicationClass)) { + // default getApplicationClass never checks if it's a subclass + // of Application + return new Application() { + @Override + protected String getRootClassName(WrappedRequest request) { + return applicationClass.getCanonicalName(); + } + }; + } + final Application application = applicationClass.newInstance(); return application; } catch (final IllegalAccessException e) { throw new ServletException(e); @@ -150,7 +163,6 @@ public class ApplicationRunnerServlet extends AbstractApplicationServlet { return uris; } - @SuppressWarnings("unchecked") @Override protected Class<? extends Application> getApplicationClass() throws ClassNotFoundException { |