Corrected the URL presented in the front facade.
diff --git a/server-webapp/src/main/java/org/taverna/server/master/common/Uri.java b/server-webapp/src/main/java/org/taverna/server/master/common/Uri.java
index 20d30ef..c70670b 100644
--- a/server-webapp/src/main/java/org/taverna/server/master/common/Uri.java
+++ b/server-webapp/src/main/java/org/taverna/server/master/common/Uri.java
@@ -23,7 +23,6 @@
import org.apache.commons.logging.Log;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Required;
import org.springframework.security.web.PortMapper;
import edu.umd.cs.findbugs.annotations.NonNull;
@@ -147,7 +146,6 @@
}
@Autowired
- @Required
public void setPortMapper(PortMapper portMapper) {
this.portMapper = portMapper;
}
diff --git a/server-webapp/src/main/java/org/taverna/server/master/facade/Facade.java b/server-webapp/src/main/java/org/taverna/server/master/facade/Facade.java
index 9f46266..0015754 100644
--- a/server-webapp/src/main/java/org/taverna/server/master/facade/Facade.java
+++ b/server-webapp/src/main/java/org/taverna/server/master/facade/Facade.java
@@ -67,10 +67,7 @@
@Path("{dummy:.*}")
@Produces("text/html")
public Response get(@Context UriInfo ui) {
- String url = ui.getBaseUri().toString().replace("%2D", "-");
- if (!url.endsWith("/"))
- url += "/";
- return ok(contextualizer.contextualize(welcome), TEXT_HTML_TYPE)
+ return ok(contextualizer.contextualize(ui, welcome), TEXT_HTML_TYPE)
.build();
}
}
diff --git a/server-webapp/src/main/java/org/taverna/server/master/utils/Contextualizer.java b/server-webapp/src/main/java/org/taverna/server/master/utils/Contextualizer.java
index 19596bb..884ff94 100644
--- a/server-webapp/src/main/java/org/taverna/server/master/utils/Contextualizer.java
+++ b/server-webapp/src/main/java/org/taverna/server/master/utils/Contextualizer.java
@@ -6,6 +6,7 @@
package org.taverna.server.master.utils;
import javax.servlet.ServletContext;
+import javax.ws.rs.core.UriInfo;
import org.springframework.web.context.ServletContextAware;
import org.taverna.server.master.common.version.Version;
@@ -19,6 +20,7 @@
public class Contextualizer implements ServletContextAware {
static final String ROOT_PLACEHOLDER = "%{WEBAPPROOT}";
static final String VERSION_PLACEHOLDER = "%{VERSION}";
+ static final String BASE_PLACEHOLDER = "%{BASEURL}";
/**
* Apply the contextualization operation. This consists of replacing the
@@ -35,6 +37,26 @@
VERSION_PLACEHOLDER, Version.JAVA);
}
+ /**
+ * Apply the contextualization operation. This consists of replacing the
+ * string <tt>{@value #ROOT_PLACEHOLDER}</tt> with the real root of the
+ * webapp.
+ *
+ * @param ui
+ * Where to get information about the URL used to access the
+ * webapp.
+ * @param input
+ * the string to contextualize
+ * @return the contextualized string
+ */
+ public String contextualize(UriInfo ui, String input) {
+ // Hack to work around bizarre CXF bug
+ String baseuri = ui.getBaseUri().toString().replace("%2D", "-");
+ if (baseuri.endsWith("/"))
+ baseuri = baseuri.substring(0, baseuri.length() - 1);
+ return contextualize(input).replace(BASE_PLACEHOLDER, baseuri);
+ }
+
private ServletContext context;
@Override
diff --git a/server-webapp/src/main/resources/welcome.html b/server-webapp/src/main/resources/welcome.html
index 6430d5a..856f3e2 100644
--- a/server-webapp/src/main/resources/welcome.html
+++ b/server-webapp/src/main/resources/welcome.html
@@ -7,7 +7,7 @@
<body>
<h1>Taverna Server %{VERSION}</h1>
<p>For a full list of operations, see the <a
- href="%{WEBAPPROOT}/services">service listing</a> generated by Apache
+ href="%{BASEURL}/services">service listing</a> generated by Apache
CXF, which indicates where to access the WSDL and WADL descriptions of
the T2Server interface.</p>
<p>What follows below is a simple guide to using the server. It does
@@ -21,11 +21,11 @@
<ol>
<li>
<p>The client starts by creating a workflow run. This is done by POSTing a
- T2flow document to the service at the address <tt>%{WEBAPPROOT}/rest/runs</tt>
+ T2flow document to the service at the address <tt>%{BASEURL}/rest/runs</tt>
with the content type <tt>application/vnd.taverna.t2flow+xml</tt>.</p>
<p>The result of the POST is an <tt>HTTP 201 Created</tt> that gives the
location of the created run (in a <tt>Location</tt> header),
- <tt>%{WEBAPPROOT}/rest/runs/<b>UUID</b></tt> (where <tt><b>UUID</b></tt> is a
+ <tt>%{BASEURL}/rest/runs/<b>UUID</b></tt> (where <tt><b>UUID</b></tt> is a
unique string that identifies the particular run; this is also the name of
the run that you would use in the SOAP interface). Note that the run is not
yet actually doing anything.</p>
@@ -34,7 +34,7 @@
<p>Next, you need to set up the inputs to the workflow ports. To set the
input port, <tt><b>FOO</b></tt>, to have the value <tt><b>BAR</b></tt>, you
would PUT a message like this to the URI
- <tt>%{WEBAPPROOT}/rest/runs/<b>UUID</b>/input/input/<b>FOO</b></tt>
+ <tt>%{BASEURL}/rest/runs/<b>UUID</b>/input/input/<b>FOO</b></tt>
</p>
<blockquote><pre><t2sr:runInput xmlns:t2sr="http://ns.taverna.org.uk/2010/xml/server/rest/">
<t2sr:value><b>BAR</b></t2sr:value>
@@ -42,13 +42,13 @@
</li>
<li>
<p>Now you can start the file running. This is done by using a PUT to set
- <tt>%{WEBAPPROOT}/rest/runs/<b>UUID</b>/status</tt> to the plain text value
+ <tt>%{BASEURL}/rest/runs/<b>UUID</b>/status</tt> to the plain text value
<tt>Operating</tt>.</p>
</li>
<li>
<p>Now you need to poll, waiting for the workflow to finish. To discover the
state of a run, you can (at any time) do a GET on
- <tt>%{WEBAPPROOT}/rest/runs/<b>UUID</b>/status</tt>; when the workflow has
+ <tt>%{BASEURL}/rest/runs/<b>UUID</b>/status</tt>; when the workflow has
finished executing, this will return <tt>Finished</tt> instead of
<tt>Operating</tt> (or <tt>Initialized</tt>, the starting state).</p>
</li>
@@ -57,7 +57,7 @@
and all resources (i.e., local files) associated with it cleaned up. By
default in this release, this is 20 minutes after initial creation. To see
when a particular run is scheduled to be disposed of, do a GET on
- <tt>%{WEBAPPROOT}/rest/runs/<b>UUID</b>/expiry</tt>; you may set the time when
+ <tt>%{BASEURL}/rest/runs/<b>UUID</b>/expiry</tt>; you may set the time when
the run is disposed of by PUTting a new time to that same URI. Note that
this includes not just the time when the workflow is executing, but also
when the input files are being created beforehand and when the results are
@@ -68,19 +68,19 @@
<p>The outputs from the workflow are files created in the <tt>out</tt>
subdirectory of the run's working directory. The contents of the
subdirectory can be read by doing a GET on
- <tt>%{WEBAPPROOT}/rest/runs/<b>UUID</b>/wd/out</tt> which will return an XML
+ <tt>%{BASEURL}/rest/runs/<b>UUID</b>/wd/out</tt> which will return an XML
document describing the contents of the directory, with links to each of the
files within it. Doing a GET on those links will retrieve the actual created
files (as uninterpreted binary data).</p>
<p>Thus, if a single output <tt><b>FOO.OUT</b></tt> was produced from the
workflow, it would be written to the file that can be retrieved from
- <tt>%{WEBAPPROOT}/rest/runs/<b>UUID</b>/wd/out/<b>FOO.OUT</b></tt> and the
- result of the GET on <tt>%{WEBAPPROOT}/rest/runs/<b>UUID</b>/wd/out</tt> would
+ <tt>%{BASEURL}/rest/runs/<b>UUID</b>/wd/out/<b>FOO.OUT</b></tt> and the
+ result of the GET on <tt>%{BASEURL}/rest/runs/<b>UUID</b>/wd/out</tt> would
look something like this:</p>
<blockquote><pre><t2sr:directoryContents xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:t2sr="http://ns.taverna.org.uk/2010/xml/server/rest"
xmlns:t2s="http://ns.taverna.org.uk/2010/xml/server/">
- <t2s:file xlink:href="%{WEBAPPROOT}/rest/runs/<b>UUID</b>/wd/out/<b>FOO.OUT</b>"
+ <t2s:file xlink:href="%{BASEURL}/rest/runs/<b>UUID</b>/wd/out/<b>FOO.OUT</b>"
t2sr:name="<b>FOO.OUT</b>">out/<b>FOO.OUT</b></t2s:file>
</t2sr:directoryContents></pre></blockquote>
</li>
@@ -88,7 +88,7 @@
<p>The standard output and standard error from the T2 Command Line Executor
subprocess can be read via properties of the special I/O listener. To do
that, do a GET on
- <tt>%{WEBAPPROOT}/rest/runs/<b>UUID</b>/listeners/io/properties/<b>stdout</b></tt>
+ <tt>%{BASEURL}/rest/runs/<b>UUID</b>/listeners/io/properties/<b>stdout</b></tt>
(or <tt>.../<b>stderr</b></tt>). Once the subprocess has finished executing,
the I/O listener will provide a third property containing the exit code of
the subprocess, called <tt>exitcode</tt>.</p> <p>Note that the supported set
@@ -97,14 +97,14 @@
</li>
<li>
<p>Once you have finished, destroy the run by doing a DELETE on
- <tt>%{WEBAPPROOT}/rest/runs/<b>UUID</b></tt>. Once you have done that, none of
+ <tt>%{BASEURL}/rest/runs/<b>UUID</b></tt>. Once you have done that, none of
the resources associated with the run (including both input and output
files) will exist any more. If the run is still executing, this will also
cause it to be stopped.</p>
</li>
</ol>
<p>All operations described above have equivalents in the
-<a href="%{WEBAPPROOT}/soap?wsdl">SOAP service interface</a>.</p>
+<a href="%{BASEURL}/soap?wsdl">SOAP service interface</a>.</p>
<div>
<hr>