summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2012-10-11 15:44:04 +0000
committerrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2012-10-11 15:44:04 +0000
commitf592a6e21180e86ea5de9125b1fa6a7763377608 (patch)
tree51ec5f9c53e8563e9e3f2f97507ca767cbf9b187
parentc782c4865737d0dff39156a516a488bef05e66a0 (diff)
Fix an issue related to @Path on the jaxrs interface
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1397118 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--sca-java-2.x/trunk/modules/binding-rest-runtime/src/main/java/org/apache/tuscany/sca/binding/rest/provider/RESTServiceBindingProvider.java10
-rw-r--r--sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/wireformat/json/CatalogServiceTestCase.java2
-rw-r--r--sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/services/store/Catalog.java1
-rw-r--r--sca-java-2.x/trunk/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/client/HttpClientFactory.java18
4 files changed, 21 insertions, 10 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 2b3d0f7e41..7e8f473117 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
@@ -28,6 +28,7 @@ import java.util.Set;
import javax.servlet.Servlet;
import javax.ws.rs.core.Application;
import javax.ws.rs.core.MediaType;
+import javax.ws.rs.Path;
import javax.xml.namespace.QName;
import org.apache.tuscany.sca.binding.rest.RESTBinding;
@@ -354,6 +355,15 @@ public class RESTServiceBindingProvider implements EndpointProvider {
if (path.startsWith(servletHost.getContextPath())) {
path = path.substring(servletHost.getContextPath().length());
}
+ // Try to append the interface level @Path
+ Path p = interfaze.getAnnotation(Path.class);
+ String cp = p == null ? "" : p.value().trim();
+ if(cp.startsWith("/")) {
+ cp = cp.substring(1);
+ }
+ if(!"".equals(cp)) {
+ path = path +"/" + cp;
+ }
Class<?> cls =
RootResourceClassGenerator.generateRootResourceClass(interfaze,
path,
diff --git a/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/wireformat/json/CatalogServiceTestCase.java b/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/wireformat/json/CatalogServiceTestCase.java
index 7a07c9b5c8..4688272a39 100644
--- a/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/wireformat/json/CatalogServiceTestCase.java
+++ b/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/wireformat/json/CatalogServiceTestCase.java
@@ -40,7 +40,7 @@ import com.meterware.httpunit.WebRequest;
import com.meterware.httpunit.WebResponse;
public class CatalogServiceTestCase {
- private static final String SERVICE_URL = "http://localhost:8085/Catalog";
+ private static final String SERVICE_URL = "http://localhost:8085/Catalog/catalog";
private static final String GET_RESPONSE =
"{\"items\":[{\"price\":\"$1.55\",\"name\":\"Pear\"},{\"price\":\"$2.99\",\"name\":\"Apple\"},{\"price\":\"$3.55\",\"name\":\"Orange\"}]}";
diff --git a/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/services/store/Catalog.java b/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/services/store/Catalog.java
index 5fb29782f2..9940d0601e 100644
--- a/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/services/store/Catalog.java
+++ b/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/services/store/Catalog.java
@@ -33,6 +33,7 @@ import org.oasisopen.sca.annotation.Remotable;
@Remotable
+@Path("catalog")
public interface Catalog {
@GET
diff --git a/sca-java-2.x/trunk/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/client/HttpClientFactory.java b/sca-java-2.x/trunk/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/client/HttpClientFactory.java
index 53b24a2f11..af61963e13 100644
--- a/sca-java-2.x/trunk/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/client/HttpClientFactory.java
+++ b/sca-java-2.x/trunk/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/client/HttpClientFactory.java
@@ -46,15 +46,15 @@ import org.apache.tuscany.sca.core.UtilityExtensionPoint;
* @version $Rev$ $Date$
*/
public class HttpClientFactory implements LifeCycleListener {
- private int soTimeout = 30000;
- private int connectionTimeout = 60000;
- private boolean staleCheckingEnabled = false;
- private long timeToLive = 60; // seconds
- private int maxPerRoute = 256;
- private int maxTotal = 1024;
- private boolean sslHostVerificationEnabled = false;
-
- private HttpClient httpClient;
+ protected int soTimeout = 30000;
+ protected int connectionTimeout = 60000;
+ protected boolean staleCheckingEnabled = false;
+ protected long timeToLive = 60; // seconds
+ protected int maxPerRoute = 256;
+ protected int maxTotal = 1024;
+ protected boolean sslHostVerificationEnabled = false;
+
+ protected HttpClient httpClient;
public static HttpClientFactory getInstance(ExtensionPointRegistry registry) {
UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class);