summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/binding-rest-runtime
diff options
context:
space:
mode:
authorrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2010-09-10 01:12:21 +0000
committerrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2010-09-10 01:12:21 +0000
commit99356bb73f6291ad798dfb579809c355c6db71e4 (patch)
tree6f345732d7538abb64dac1f2abc389add3ed4225 /sca-java-2.x/trunk/modules/binding-rest-runtime
parent99ff864f6dc27e598f4850b80ad65b8b9c994877 (diff)
Fix the self reference with explicit bindings
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@995627 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/binding-rest-runtime')
-rw-r--r--sca-java-2.x/trunk/modules/binding-rest-runtime/src/main/java/org/apache/tuscany/sca/binding/rest/provider/RESTServiceBindingProvider.java27
1 files changed, 14 insertions, 13 deletions
diff --git a/sca-java-2.x/trunk/modules/binding-rest-runtime/src/main/java/org/apache/tuscany/sca/binding/rest/provider/RESTServiceBindingProvider.java b/sca-java-2.x/trunk/modules/binding-rest-runtime/src/main/java/org/apache/tuscany/sca/binding/rest/provider/RESTServiceBindingProvider.java
index 9a9e5a108e..eaf830ceb5 100644
--- a/sca-java-2.x/trunk/modules/binding-rest-runtime/src/main/java/org/apache/tuscany/sca/binding/rest/provider/RESTServiceBindingProvider.java
+++ b/sca-java-2.x/trunk/modules/binding-rest-runtime/src/main/java/org/apache/tuscany/sca/binding/rest/provider/RESTServiceBindingProvider.java
@@ -211,9 +211,13 @@ public class RESTServiceBindingProvider implements EndpointProvider {
throw new IllegalStateException("No get or service method found on the service");
}
+ servletMapping = registerServlet(servlet);
+ }
+
+ public String registerServlet(Servlet servlet) {
// Create our HTTP service listener Servlet and register it with the
// Servlet host
- servletMapping = binding.getURI();
+ String servletMapping = binding.getURI();
if (!servletMapping.endsWith("/")) {
servletMapping += "/";
}
@@ -221,7 +225,13 @@ public class RESTServiceBindingProvider implements EndpointProvider {
servletMapping += "*";
}
- servletHost.addServletMapping(servletMapping, servlet);
+ String mappedURI = servletHost.addServletMapping(servletMapping, servlet);
+ String deployedURI = mappedURI;
+ if (deployedURI.endsWith("*")) {
+ deployedURI = deployedURI.substring(0, deployedURI.length() - 1);
+ }
+ binding.setURI(deployedURI);
+ return mappedURI;
}
public void stop() {
@@ -258,17 +268,8 @@ public class RESTServiceBindingProvider implements EndpointProvider {
TuscanyRESTServlet restServlet = new TuscanyRESTServlet(extensionPoints, application.resourceClass);
- // Create our HTTP service listener Servlet and register it with the
- // Servlet host
- servletMapping = binding.getURI();
- if (!servletMapping.endsWith("/")) {
- servletMapping += "/";
- }
- if (!servletMapping.endsWith("*")) {
- servletMapping += "*";
- }
-
- servletHost.addServletMapping(servletMapping, restServlet);
+ servletMapping = registerServlet(restServlet);
+
RegistrationUtils.registerApplication(application, restServlet.getServletContext());
return application;
} else {