summaryrefslogtreecommitdiffstats
path: root/uitest/src
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2012-09-07 10:07:42 +0300
committerLeif Åstrand <leif@vaadin.com>2012-09-07 10:07:42 +0300
commit73f50d5027288b4358880a638911bec276384a34 (patch)
tree308d97749fcf2add11cce2d8d96cf48fce41e47d /uitest/src
parent0cffb22cf4f746746b1398a88a26b7bd572e84b4 (diff)
downloadvaadin-framework-73f50d5027288b4358880a638911bec276384a34.tar.gz
vaadin-framework-73f50d5027288b4358880a638911bec276384a34.zip
Redesign to make session inited in Application.init (#9402)
Diffstat (limited to 'uitest/src')
-rw-r--r--uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java27
1 files changed, 16 insertions, 11 deletions
diff --git a/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java b/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java
index 029bebd9c9..df7c9c5db9 100644
--- a/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java
+++ b/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java
@@ -111,28 +111,32 @@ public class ApplicationRunnerServlet extends LegacyVaadinServlet {
}
@Override
- protected VaadinServletSession createApplication(HttpServletRequest request)
+ protected boolean shouldCreateApplication(WrappedHttpServletRequest request)
throws ServletException {
try {
+ return Application.class.isAssignableFrom(getClassToRun());
+ } catch (ClassNotFoundException e) {
+ throw new ServletException(e);
+ }
+ }
+
+ @Override
+ protected void onVaadinSessionStarted(WrappedHttpServletRequest request,
+ VaadinServletSession session) throws ServletException {
+ try {
final Class<?> classToRun = getClassToRun();
if (UI.class.isAssignableFrom(classToRun)) {
- VaadinServletSession application = new VaadinServletSession();
- application.addUIProvider(new AbstractUIProvider() {
+ session.addUIProvider(new AbstractUIProvider() {
@Override
- public Class<? extends UI> getUIClass(
- WrappedRequest request) {
+ public Class<? extends UI> getUIClass(WrappedRequest request) {
return (Class<? extends UI>) classToRun;
}
});
- return application;
} else if (Application.class.isAssignableFrom(classToRun)) {
- return super.createApplication(request);
+ // Avoid using own UIProvider for legacy Application
} else if (UIProvider.class.isAssignableFrom(classToRun)) {
- VaadinServletSession application = new VaadinServletSession();
- application
- .addUIProvider((UIProvider) classToRun.newInstance());
- return application;
+ session.addUIProvider((UIProvider) classToRun.newInstance());
} else {
throw new ServletException(classToRun.getCanonicalName()
+ " is neither an Application nor a UI");
@@ -148,6 +152,7 @@ public class ApplicationRunnerServlet extends LegacyVaadinServlet {
+ getApplicationRunnerApplicationClassName(request)));
}
+ super.onVaadinSessionStarted(request, session);
}
private String getApplicationRunnerApplicationClassName(