summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk
diff options
context:
space:
mode:
authorrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2010-06-01 22:58:01 +0000
committerrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2010-06-01 22:58:01 +0000
commit0f3e6d06982ce1f7c43a1411021bf0192489bd63 (patch)
tree3fbdefafb6e7ec4332556c28033ce2126f9bbf66 /sca-java-2.x/trunk
parent5921316d0d9517868c28714e336e46a16eb73573 (diff)
Adjust the path URI for web app deployment
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@950296 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk')
-rw-r--r--sca-java-2.x/trunk/modules/binding-rest-runtime/META-INF/MANIFEST.MF16
-rw-r--r--sca-java-2.x/trunk/modules/binding-rest-runtime/src/main/java/org/apache/tuscany/sca/binding/rest/provider/RESTBindingInvoker.java11
-rw-r--r--sca-java-2.x/trunk/modules/binding-rest-runtime/src/main/java/org/apache/tuscany/sca/binding/rest/provider/RESTServiceBindingProvider.java5
-rw-r--r--sca-java-2.x/trunk/modules/binding-rest-runtime/src/main/java/org/apache/tuscany/sca/binding/rest/provider/TuscanyRESTServlet.java2
-rw-r--r--sca-java-2.x/trunk/modules/implementation-jaxrs-runtime/META-INF/MANIFEST.MF1
-rw-r--r--sca-java-2.x/trunk/modules/interface-java-jaxrs/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxrs/RootResourceClassGenerator.java4
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;