diff options
Diffstat (limited to '')
6 files changed, 34 insertions, 5 deletions
diff --git a/sca-java-2.x/trunk/modules/binding-rest-runtime/META-INF/MANIFEST.MF b/sca-java-2.x/trunk/modules/binding-rest-runtime/META-INF/MANIFEST.MF index 80758692b0..1da959a392 100644 --- a/sca-java-2.x/trunk/modules/binding-rest-runtime/META-INF/MANIFEST.MF +++ b/sca-java-2.x/trunk/modules/binding-rest-runtime/META-INF/MANIFEST.MF @@ -8,8 +8,13 @@ Bundle-Version: 2.0.0 Bundle-ManifestVersion: 2 Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt Bundle-Description: Apache Tuscany SCA REST Binding Runtime -Import-Package: javax.servlet, +Import-Package: javax.jws, + javax.servlet, javax.servlet.http, + javax.ws.rs, + javax.ws.rs.core, + javax.ws.rs.ext, + javax.xml, org.apache.tuscany.sca.assembly;version="2.0.0", org.apache.tuscany.sca.binding.rest;version="2.0.0", org.apache.tuscany.sca.binding.rest.operationselector.jaxrs;version="2.0.0", @@ -28,6 +33,15 @@ Import-Package: javax.servlet, org.apache.tuscany.sca.invocation;version="2.0.0", org.apache.tuscany.sca.provider;version="2.0.0", org.apache.tuscany.sca.runtime;version="2.0.0", + org.apache.wink.client, + org.apache.wink.client.handlers, + org.apache.wink.common, + org.apache.wink.server.utils, + org.apache.wink.common.internal.registry, + org.apache.wink.common.internal.registry.metadata, + org.apache.wink.server.internal, + org.apache.wink.server.internal.registry, + org.apache.wink.server.internal.servlet, org.oasisopen.sca;version="2.0.0", org.oasisopen.sca.annotation;version="2.0.0" Bundle-SymbolicName: org.apache.tuscany.sca.binding.rest.runtime diff --git a/sca-java-2.x/trunk/modules/binding-rest-runtime/src/main/java/org/apache/tuscany/sca/binding/rest/provider/RESTBindingInvoker.java b/sca-java-2.x/trunk/modules/binding-rest-runtime/src/main/java/org/apache/tuscany/sca/binding/rest/provider/RESTBindingInvoker.java index b5017c71f2..325aeff018 100644 --- a/sca-java-2.x/trunk/modules/binding-rest-runtime/src/main/java/org/apache/tuscany/sca/binding/rest/provider/RESTBindingInvoker.java +++ b/sca-java-2.x/trunk/modules/binding-rest-runtime/src/main/java/org/apache/tuscany/sca/binding/rest/provider/RESTBindingInvoker.java @@ -60,6 +60,7 @@ import org.apache.tuscany.sca.invocation.Message; import org.apache.wink.client.ClientConfig; import org.apache.wink.client.Resource; import org.apache.wink.client.RestClient; +import org.apache.wink.client.handlers.BasicAuthSecurityHandler; /** * @@ -101,6 +102,9 @@ public class RESTBindingInvoker implements Invoker { private RestClient createRestClient() { ClientConfig config = new ClientConfig(); + + // configureBasicAuth(config, userName, password); + config.applications(new Application() { @Override @@ -134,6 +138,13 @@ public class RESTBindingInvoker implements Invoker { return client; } + private void configureBasicAuth(ClientConfig config, String userName, String password) { + BasicAuthSecurityHandler basicAuthSecurityHandler = new BasicAuthSecurityHandler(); + basicAuthSecurityHandler.setUserName(userName); + basicAuthSecurityHandler.setPassword(password); + config.handlers(basicAuthSecurityHandler); + } + public Message invoke(Message msg) { Object entity = null; 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 b672c3ee2d..46002e3226 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 @@ -283,6 +283,11 @@ public class RESTServiceBindingProvider implements EndpointProvider { String uri = endpoint.getBinding().getURI(); String path = URI.create(uri).getPath(); + + // FIXME: [rfeng] We need to have a better way to deal with URI template for bindings + if(path.startsWith(servletHost.getContextPath())) { + path = path.substring(servletHost.getContextPath().length()); + } Class<?> cls = RootResourceClassGenerator.generateRootResourceClass(interfaze, path, diff --git a/sca-java-2.x/trunk/modules/binding-rest-runtime/src/main/java/org/apache/tuscany/sca/binding/rest/provider/TuscanyRESTServlet.java b/sca-java-2.x/trunk/modules/binding-rest-runtime/src/main/java/org/apache/tuscany/sca/binding/rest/provider/TuscanyRESTServlet.java index 13f13e4dde..23b951c88a 100644 --- a/sca-java-2.x/trunk/modules/binding-rest-runtime/src/main/java/org/apache/tuscany/sca/binding/rest/provider/TuscanyRESTServlet.java +++ b/sca-java-2.x/trunk/modules/binding-rest-runtime/src/main/java/org/apache/tuscany/sca/binding/rest/provider/TuscanyRESTServlet.java @@ -54,6 +54,7 @@ public class TuscanyRESTServlet extends RestServlet { public DeploymentConfiguration getDeploymentConfiguration() throws ClassNotFoundException, InstantiationException, IllegalAccessException, IOException { DeploymentConfiguration config = super.getDeploymentConfiguration(); + // [rfeng] FIXME: This is a hack to fool Apache wink to not remove the servlet path config.setFilterConfig(new FilterConfig() { @@ -73,6 +74,7 @@ public class TuscanyRESTServlet extends RestServlet { return getServletName(); } }); + ProvidersRegistry providers = config.getProvidersRegistry(); providers.addProvider(new DataBindingJAXRSReader(registry), 0.001, true); providers.addProvider(new DataBindingJAXRSWriter(registry), 0.001, true); diff --git a/sca-java-2.x/trunk/modules/implementation-jaxrs-runtime/META-INF/MANIFEST.MF b/sca-java-2.x/trunk/modules/implementation-jaxrs-runtime/META-INF/MANIFEST.MF index d914db4ea2..90894d9bd0 100644 --- a/sca-java-2.x/trunk/modules/implementation-jaxrs-runtime/META-INF/MANIFEST.MF +++ b/sca-java-2.x/trunk/modules/implementation-jaxrs-runtime/META-INF/MANIFEST.MF @@ -24,6 +24,7 @@ Import-Package: javax.servlet, org.apache.tuscany.sca.runtime;version="2.0.0",
org.apache.wink.server.internal,
org.apache.wink.server.internal.handlers,
+ org.apache.wink.server.internal.registry,
org.apache.wink.server.internal.servlet,
org.apache.wink.server.utils,
org.oasisopen.sca;version="2.0.0",
diff --git a/sca-java-2.x/trunk/modules/interface-java-jaxrs/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxrs/RootResourceClassGenerator.java b/sca-java-2.x/trunk/modules/interface-java-jaxrs/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxrs/RootResourceClassGenerator.java index 969efeb4f1..8ee34e79f4 100644 --- a/sca-java-2.x/trunk/modules/interface-java-jaxrs/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxrs/RootResourceClassGenerator.java +++ b/sca-java-2.x/trunk/modules/interface-java-jaxrs/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxrs/RootResourceClassGenerator.java @@ -22,10 +22,6 @@ package org.apache.tuscany.sca.interfacedef.java.jaxrs; import java.lang.reflect.Field; import java.lang.reflect.Method; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.HEAD; - import org.objectweb.asm.AnnotationVisitor; import org.objectweb.asm.ClassWriter; import org.objectweb.asm.FieldVisitor; |