Author: rfeng
Date: Thu Oct 11 15:44:04 2012
New Revision: 1397118

URL: http://svn.apache.org/viewvc?rev=1397118&view=rev
Log:
Fix an issue related to @Path on the jaxrs interface

Modified:
    
tuscany/sca-java-2.x/trunk/modules/binding-rest-runtime/src/main/java/org/apache/tuscany/sca/binding/rest/provider/RESTServiceBindingProvider.java
    
tuscany/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/wireformat/json/CatalogServiceTestCase.java
    
tuscany/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/services/store/Catalog.java
    
tuscany/sca-java-2.x/trunk/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/client/HttpClientFactory.java

Modified: 
tuscany/sca-java-2.x/trunk/modules/binding-rest-runtime/src/main/java/org/apache/tuscany/sca/binding/rest/provider/RESTServiceBindingProvider.java
URL: 
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-rest-runtime/src/main/java/org/apache/tuscany/sca/binding/rest/provider/RESTServiceBindingProvider.java?rev=1397118&r1=1397117&r2=1397118&view=diff
==============================================================================
--- 
tuscany/sca-java-2.x/trunk/modules/binding-rest-runtime/src/main/java/org/apache/tuscany/sca/binding/rest/provider/RESTServiceBindingProvider.java
 (original)
+++ 
tuscany/sca-java-2.x/trunk/modules/binding-rest-runtime/src/main/java/org/apache/tuscany/sca/binding/rest/provider/RESTServiceBindingProvider.java
 Thu Oct 11 15:44:04 2012
@@ -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 
                 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,

Modified: 
tuscany/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/wireformat/json/CatalogServiceTestCase.java
URL: 
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/wireformat/json/CatalogServiceTestCase.java?rev=1397118&r1=1397117&r2=1397118&view=diff
==============================================================================
--- 
tuscany/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/wireformat/json/CatalogServiceTestCase.java
 (original)
+++ 
tuscany/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/wireformat/json/CatalogServiceTestCase.java
 Thu Oct 11 15:44:04 2012
@@ -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\"}]}";

Modified: 
tuscany/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/services/store/Catalog.java
URL: 
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/services/store/Catalog.java?rev=1397118&r1=1397117&r2=1397118&view=diff
==============================================================================
--- 
tuscany/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/services/store/Catalog.java
 (original)
+++ 
tuscany/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/services/store/Catalog.java
 Thu Oct 11 15:44:04 2012
@@ -33,6 +33,7 @@ import org.oasisopen.sca.annotation.Remo
 
 
 @Remotable
+@Path("catalog")
 public interface Catalog {
     
     @GET

Modified: 
tuscany/sca-java-2.x/trunk/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/client/HttpClientFactory.java
URL: 
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/client/HttpClientFactory.java?rev=1397118&r1=1397117&r2=1397118&view=diff
==============================================================================
--- 
tuscany/sca-java-2.x/trunk/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/client/HttpClientFactory.java
 (original)
+++ 
tuscany/sca-java-2.x/trunk/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/client/HttpClientFactory.java
 Thu Oct 11 15:44:04 2012
@@ -46,15 +46,15 @@ import org.apache.tuscany.sca.core.Utili
  * @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;
+    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;
 
-    private HttpClient httpClient;
+    protected HttpClient httpClient;
 
     public static HttpClientFactory getInstance(ExtensionPointRegistry 
registry) {
         UtilityExtensionPoint utilities = 
registry.getExtensionPoint(UtilityExtensionPoint.class);


Reply via email to