From: Matti Tahvonen Date: Wed, 12 Dec 2007 12:43:38 +0000 (+0000) Subject: fixing testing server default uri (when not specified in web.xml) X-Git-Tag: 6.7.0.beta1~5242 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=f5f2e1116704d9019c99e17691889f70621e6b4c;p=vaadin-framework.git fixing testing server default uri (when not specified in web.xml) svn changeset:3223/svn branch:trunk --- diff --git a/src/com/itmill/toolkit/terminal/gwt/server/ApplicationServlet.java b/src/com/itmill/toolkit/terminal/gwt/server/ApplicationServlet.java index 20a46b34aa..bdc93fcd0b 100644 --- a/src/com/itmill/toolkit/terminal/gwt/server/ApplicationServlet.java +++ b/src/com/itmill/toolkit/terminal/gwt/server/ApplicationServlet.java @@ -671,7 +671,8 @@ public class ApplicationServlet extends HttpServlet { page.write("', themeUri: "); page.write(themeUri != null ? "'" + themeUri + "'" : "null"); if (testingWindow) { - page.write(", testingToolsUri : '" + getTestingToolsUri() + "'"); + page.write(", testingToolsUri : '" + getTestingToolsUri(request) + + "'"); } page.write("\n};\n\n"); @@ -703,7 +704,7 @@ public class ApplicationServlet extends HttpServlet { private void writeTestingToolsScripts(Writer page, HttpServletRequest request) throws IOException { // ATF script and CSS files are served from ATFServer - String ext = getTestingToolsUri(); + String ext = getTestingToolsUri(request); ext = ext.substring(0, ext.lastIndexOf('/')); page.write("\n"); @@ -713,15 +714,18 @@ public class ApplicationServlet extends HttpServlet { || request.getParameter("ATF-TS") != null) { proxyTestCases(request.getParameter("ATF-TC"), request .getParameter("ATF-TS"), request - .getParameter("ATF-TS-RUN-ID"), page); + .getParameter("ATF-TS-RUN-ID"), page, + getTestingToolsUri(request)); } } - private String getTestingToolsUri() { + private String getTestingToolsUri(HttpServletRequest request) { if (testingToolsServerUri == null) { // Default behavior is that ATFServer application exists on // same application server as current application does. - testingToolsServerUri = "/ATF/ATFServer"; + testingToolsServerUri = "http" + (request.isSecure() ? "s" : "") + + "://" + request.getServerName() + ":" + + request.getLocalPort() + "/ATF/ATFServer"; } return testingToolsServerUri; } @@ -734,26 +738,26 @@ public class ApplicationServlet extends HttpServlet { * @param testSuiteId * @param testSuiteRunId * @param page + * @param testServerUri * @throws IOException * @throws MalformedURLException */ private void proxyTestCases(String testCaseId, String testSuiteId, - String testSuiteRunId, Writer page) throws IOException, - MalformedURLException { + String testSuiteRunId, Writer page, String testServerUri) + throws IOException, MalformedURLException { URLConnection conn; - String testCaseProviderURL = getTestingToolsUri(); if (testCaseId != null) { - testCaseProviderURL += "/ATF-TC/" + testCaseId; + testServerUri += "/ATF-TC/" + testCaseId; } if (testSuiteId != null) { - testCaseProviderURL += "/ATF-TS/" + testSuiteId; + testServerUri += "/ATF-TS/" + testSuiteId; } if (testSuiteRunId != null) { - testCaseProviderURL += "/ATF-TS-RUN-ID/" + testSuiteRunId; + testServerUri += "/ATF-TS-RUN-ID/" + testSuiteRunId; } - conn = new URL(testCaseProviderURL).openConnection(); + conn = new URL(testServerUri).openConnection(); InputStream is = conn.getInputStream(); StringBuffer builder = new StringBuffer();