summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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);