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/RESTBindingListenerServlet.java4
-rw-r--r--sca-java-2.x/trunk/modules/binding-rest-runtime/src/main/java/org/apache/tuscany/sca/binding/rest/provider/RESTServiceListenerServlet.java4
-rw-r--r--sca-java-2.x/trunk/modules/binding-rest/src/main/java/org/apache/tuscany/sca/binding/rest/xml/RESTBindingProcessor.java1
3 files changed, 9 insertions, 0 deletions
diff --git a/sca-java-2.x/trunk/modules/binding-rest-runtime/src/main/java/org/apache/tuscany/sca/binding/rest/provider/RESTBindingListenerServlet.java b/sca-java-2.x/trunk/modules/binding-rest-runtime/src/main/java/org/apache/tuscany/sca/binding/rest/provider/RESTBindingListenerServlet.java
index e0a681ed36..f6d5778aba 100644
--- a/sca-java-2.x/trunk/modules/binding-rest-runtime/src/main/java/org/apache/tuscany/sca/binding/rest/provider/RESTBindingListenerServlet.java
+++ b/sca-java-2.x/trunk/modules/binding-rest-runtime/src/main/java/org/apache/tuscany/sca/binding/rest/provider/RESTBindingListenerServlet.java
@@ -39,6 +39,7 @@ import org.apache.tuscany.sca.common.http.HTTPCacheContext;
import org.apache.tuscany.sca.common.http.HTTPContentTypeMapper;
import org.apache.tuscany.sca.common.http.HTTPContext;
import org.apache.tuscany.sca.common.http.HTTPHeader;
+import org.apache.tuscany.sca.common.http.cors.CORSHeaderProcessor;
import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.invocation.Message;
import org.apache.tuscany.sca.invocation.MessageFactory;
@@ -78,6 +79,9 @@ public class RESTBindingListenerServlet extends HttpServlet {
@Override
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+ if (binding.isCORS()) {
+ CORSHeaderProcessor.processCORS(binding.getCORSConfiguration(), request, response);
+ }
if( binding.getOperationSelector() != null || binding.getRequestWireFormat() != null) {
HTTPContext bindingContext = new HTTPContext();
bindingContext.setHttpRequest(request);
diff --git a/sca-java-2.x/trunk/modules/binding-rest-runtime/src/main/java/org/apache/tuscany/sca/binding/rest/provider/RESTServiceListenerServlet.java b/sca-java-2.x/trunk/modules/binding-rest-runtime/src/main/java/org/apache/tuscany/sca/binding/rest/provider/RESTServiceListenerServlet.java
index 1dac8a2c9a..c8b0bbf595 100644
--- a/sca-java-2.x/trunk/modules/binding-rest-runtime/src/main/java/org/apache/tuscany/sca/binding/rest/provider/RESTServiceListenerServlet.java
+++ b/sca-java-2.x/trunk/modules/binding-rest-runtime/src/main/java/org/apache/tuscany/sca/binding/rest/provider/RESTServiceListenerServlet.java
@@ -36,6 +36,7 @@ import org.apache.tuscany.sca.binding.rest.RESTBinding;
import org.apache.tuscany.sca.common.http.HTTPCacheContext;
import org.apache.tuscany.sca.common.http.HTTPContext;
import org.apache.tuscany.sca.common.http.HTTPHeader;
+import org.apache.tuscany.sca.common.http.cors.CORSHeaderProcessor;
import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.invocation.Message;
import org.apache.tuscany.sca.invocation.MessageFactory;
@@ -82,6 +83,9 @@ public class RESTServiceListenerServlet extends HttpServlet implements Servlet {
@Override
public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+ if (binding.isCORS()) {
+ CORSHeaderProcessor.processCORS(binding.getCORSConfiguration(), request, response);
+ }
HTTPContext bindingContext = new HTTPContext();
bindingContext.setHttpRequest(request);
bindingContext.setHttpResponse(response);
diff --git a/sca-java-2.x/trunk/modules/binding-rest/src/main/java/org/apache/tuscany/sca/binding/rest/xml/RESTBindingProcessor.java b/sca-java-2.x/trunk/modules/binding-rest/src/main/java/org/apache/tuscany/sca/binding/rest/xml/RESTBindingProcessor.java
index da0e1ece06..0e8b352a2a 100644
--- a/sca-java-2.x/trunk/modules/binding-rest/src/main/java/org/apache/tuscany/sca/binding/rest/xml/RESTBindingProcessor.java
+++ b/sca-java-2.x/trunk/modules/binding-rest/src/main/java/org/apache/tuscany/sca/binding/rest/xml/RESTBindingProcessor.java
@@ -205,6 +205,7 @@ public class RESTBindingProcessor extends BaseStAXArtifactProcessor implements S
restBinding.setResponseWireFormat((WireFormat)extension);
} else if(extension instanceof OperationSelector) {
restBinding.setOperationSelector((OperationSelector)extension);
+ restBinding.setCORS(true);
}
}
break;