diff options
author | Leif Åstrand <leif@vaadin.com> | 2012-10-08 08:11:51 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2012-10-08 10:35:02 +0000 |
commit | 13d5b3e98954c2ade382305f8d044b2b49fdbd0b (patch) | |
tree | 37559368471cbed3a9ea159261869bcf5c82e52a /uitest/src/com/vaadin/launcher | |
parent | 6337f8f8ccb88014f7a3d269332661ec8183b758 (diff) | |
download | vaadin-framework-13d5b3e98954c2ade382305f8d044b2b49fdbd0b.tar.gz vaadin-framework-13d5b3e98954c2ade382305f8d044b2b49fdbd0b.zip |
Bootstrap UI using relative URLs with servlets (#6771)
* Configure widgetset using URLs relative to the requested page
* Provide a Util method for getting an absolute URL from a relative URL
* Test by using an embedded Jetty acting as a transparent proxy
* Make /embed1 use the Buttons test to enable testing UIDL requests
Change-Id: I4ef9b40e3954ae16b682d743a339f4360db40d4d
Diffstat (limited to 'uitest/src/com/vaadin/launcher')
-rw-r--r-- | uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java | 51 |
1 files changed, 2 insertions, 49 deletions
diff --git a/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java b/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java index 12d1cb2c38..0c2a1f965a 100644 --- a/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java +++ b/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java @@ -30,7 +30,6 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.vaadin.LegacyApplication; -import com.vaadin.server.DeploymentConfiguration; import com.vaadin.server.LegacyVaadinServlet; import com.vaadin.server.ServiceException; import com.vaadin.server.SessionInitEvent; @@ -40,7 +39,6 @@ import com.vaadin.server.UIProvider; import com.vaadin.server.VaadinRequest; import com.vaadin.server.VaadinServiceSession; import com.vaadin.server.VaadinServletRequest; -import com.vaadin.server.VaadinServletService; import com.vaadin.tests.components.TestBase; import com.vaadin.ui.UI; @@ -174,8 +172,9 @@ public class ApplicationRunnerServlet extends LegacyVaadinServlet { return getApplicationRunnerURIs(request).applicationClassname; } + // TODO Don't need to use a data object now that there's only one field private static class URIS { - String staticFilesPath; + // String staticFilesPath; // String applicationURI; // String context; // String runner; @@ -201,21 +200,18 @@ public class ApplicationRunnerServlet extends LegacyVaadinServlet { private static URIS getApplicationRunnerURIs(HttpServletRequest request) { final String[] urlParts = request.getRequestURI().toString() .split("\\/"); - String context = null; // String runner = null; URIS uris = new URIS(); String applicationClassname = null; String contextPath = request.getContextPath(); if (urlParts[1].equals(contextPath.replaceAll("\\/", ""))) { // class name comes after web context and runner application - context = urlParts[1]; // runner = urlParts[2]; if (urlParts.length == 3) { throw new IllegalArgumentException("No application specified"); } applicationClassname = urlParts[3]; - uris.staticFilesPath = "/" + context; // uris.applicationURI = "/" + context + "/" + runner + "/" // + applicationClassname; // uris.context = context; @@ -223,14 +219,12 @@ public class ApplicationRunnerServlet extends LegacyVaadinServlet { uris.applicationClassname = applicationClassname; } else { // no context - context = ""; // runner = urlParts[1]; if (urlParts.length == 2) { throw new IllegalArgumentException("No application specified"); } applicationClassname = urlParts[2]; - uris.staticFilesPath = "/"; // uris.applicationURI = "/" + runner + "/" + applicationClassname; // uris.context = context; // uris.runner = runner; @@ -274,47 +268,6 @@ public class ApplicationRunnerServlet extends LegacyVaadinServlet { throw new ClassNotFoundException(); } - @Override - protected String getRequestPathInfo(HttpServletRequest request) { - String path = request.getPathInfo(); - if (path == null) { - return null; - } - - path = path.substring(1 + getApplicationRunnerApplicationClassName( - request).length()); - return path; - } - - @Override - protected VaadinServletService createServletService( - DeploymentConfiguration deploymentConfiguration) { - return new VaadinServletService(this, deploymentConfiguration) { - @Override - public String getStaticFileLocation(VaadinRequest request) { - URIS uris = getApplicationRunnerURIs(VaadinServletRequest - .cast(request)); - String staticFilesPath = uris.staticFilesPath; - if (staticFilesPath.equals("/")) { - staticFilesPath = ""; - } - - return staticFilesPath; - } - }; - } - - @Override - protected VaadinServletRequest createVaadinRequest( - HttpServletRequest request) { - return new VaadinServletRequest(request, getService()) { - @Override - public String getRequestPathInfo() { - return ApplicationRunnerServlet.this.getRequestPathInfo(this); - } - }; - } - private Logger getLogger() { return Logger.getLogger(ApplicationRunnerServlet.class.getName()); } |