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
This commit is contained in:
rfeng 2012-10-11 15:44:04 +00:00
parent c782c48657
commit f592a6e211
4 changed files with 20 additions and 9 deletions

View file

@ -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,

View file

@ -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\"}]}";

View file

@ -33,6 +33,7 @@ import org.oasisopen.sca.annotation.Remotable;
@Remotable
@Path("catalog")
public interface Catalog {
@GET

View file

@ -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;
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);