summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/main
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-jsonrpc-runtime/src/main
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 '')
-rw-r--r--sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCServiceBindingProvider.java31
1 files changed, 21 insertions, 10 deletions
diff --git a/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCServiceBindingProvider.java b/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCServiceBindingProvider.java
index 39881ce68d..b6dce222ca 100644
--- a/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCServiceBindingProvider.java
+++ b/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCServiceBindingProvider.java
@@ -22,8 +22,9 @@ package org.apache.tuscany.sca.binding.jsonrpc.provider;
import java.util.ArrayList;
import java.util.List;
+import javax.servlet.Servlet;
+
import org.apache.tuscany.sca.binding.jsonrpc.JSONRPCBinding;
-import org.apache.tuscany.sca.databinding.json.JSONDataBinding;
import org.apache.tuscany.sca.host.http.ServletHost;
import org.apache.tuscany.sca.interfacedef.Interface;
import org.apache.tuscany.sca.interfacedef.InterfaceContract;
@@ -93,18 +94,28 @@ public class JSONRPCServiceBindingProvider implements ServiceBindingProvider {
// Create and register a Servlet for this service
JSONRPCServiceServlet serviceServlet =
new JSONRPCServiceServlet(messageFactory, endpoint, serviceInterface, proxy);
- String mapping = binding.getURI();
- if (!mapping.endsWith("/")) {
- mapping += "/";
+ String mapping = registerServlet(serviceServlet);
+ servletMappings.add(mapping);
+ }
+
+ public String registerServlet(Servlet servlet) {
+ // Create our HTTP service listener Servlet and register it with the
+ // Servlet host
+ String servletMapping = binding.getURI();
+ if (!servletMapping.endsWith("/")) {
+ servletMapping += "/";
}
- if (!mapping.endsWith("*")) {
- mapping += "*";
+ if (!servletMapping.endsWith("*")) {
+ servletMapping += "*";
}
- servletHost.addServletMapping(mapping, serviceServlet);
- servletMappings.add(mapping);
- servletHost.addServletMapping(binding.getURI(), serviceServlet);
- servletMappings.add(binding.getURI());
+ 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() {