aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatti Tahvonen <matti.tahvonen@itmill.com>2007-12-12 12:43:38 +0000
committerMatti Tahvonen <matti.tahvonen@itmill.com>2007-12-12 12:43:38 +0000
commitf5f2e1116704d9019c99e17691889f70621e6b4c (patch)
treeef1dc40d0ff4058c8b07cfacbb4237ac7e5968e0
parent4557fcd25607fb9607d968d3cd511e128ea4467b (diff)
downloadvaadin-framework-f5f2e1116704d9019c99e17691889f70621e6b4c.tar.gz
vaadin-framework-f5f2e1116704d9019c99e17691889f70621e6b4c.zip
fixing testing server default uri (when not specified in web.xml)
svn changeset:3223/svn branch:trunk
-rw-r--r--src/com/itmill/toolkit/terminal/gwt/server/ApplicationServlet.java28
1 files changed, 16 insertions, 12 deletions
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</script>\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("<script src=\"" + ext + "/ext/ATF.js"
+ "\" type=\"text/javascript\"></script>\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();