summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/binding-rest-runtime
diff options
context:
space:
mode:
authorlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2010-12-06 01:37:36 +0000
committerlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2010-12-06 01:37:36 +0000
commita0ca37e9952b44c052fb2b550cdc34b3c8e5051f (patch)
tree86a7c1b41519e60079a213634496a60a33f19d80 /sca-java-2.x/trunk/modules/binding-rest-runtime
parent8a2269ac3205d291ecc1bae8701fd971b737dd1d (diff)
Minor cleanup
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1042506 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/binding-rest-runtime')
-rw-r--r--sca-java-2.x/trunk/modules/binding-rest-runtime/src/main/java/org/apache/tuscany/sca/binding/rest/provider/RESTServiceBindingProvider.java101
1 files changed, 52 insertions, 49 deletions
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 ec607e9e13..fab971de53 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
@@ -157,6 +157,42 @@ public class RESTServiceBindingProvider implements EndpointProvider {
}
+ public InterfaceContract getBindingInterfaceContract() {
+ return serviceContract;
+ }
+
+
+ /**
+ * Add specific rest interceptor to invocation chain
+ */
+ public void configure() {
+
+ InvocationChain bindingChain = endpoint.getBindingInvocationChain();
+
+ if (wfProvider != null) {
+ Interceptor interceptor = wfProvider.createInterceptor();
+ if (interceptor != null) {
+ bindingChain.addInterceptor(Phase.SERVICE_BINDING_WIREFORMAT, interceptor);
+ }
+ }
+
+ if (wfResponseProvider != null) {
+ Interceptor interceptor = wfResponseProvider.createInterceptor();
+ if (interceptor != null) {
+ bindingChain.addInterceptor(Phase.SERVICE_BINDING_WIREFORMAT, interceptor);
+ }
+
+ }
+
+ if (osProvider != null) {
+ Interceptor interceptor = osProvider.createInterceptor();
+ if (interceptor != null) {
+ bindingChain.addInterceptor(Phase.SERVICE_BINDING_OPERATION_SELECTOR, interceptor);
+ }
+ }
+
+ }
+
public void start() {
InvocationChain bindingChain = endpoint.getBindingInvocationChain();
@@ -214,7 +250,21 @@ public class RESTServiceBindingProvider implements EndpointProvider {
servletMapping = registerServlet(servlet);
}
- public String registerServlet(Servlet servlet) {
+ public void stop() {
+ if (application != null) {
+ application.destroy();
+ }
+ // Unregister the Servlet from the Servlet host
+ servletHost.removeServletMapping(servletMapping);
+ }
+
+
+ public boolean supportsOneWayInvocation() {
+ return false;
+ }
+
+
+ private String registerServlet(Servlet servlet) {
// Create our HTTP service listener Servlet and register it with the
// Servlet host
String servletMapping = binding.getURI();
@@ -234,22 +284,6 @@ public class RESTServiceBindingProvider implements EndpointProvider {
return mappedURI;
}
- public void stop() {
- if (application != null) {
- application.destroy();
- }
- // Unregister the Servlet from the Servlet host
- servletHost.removeServletMapping(servletMapping);
- }
-
- public InterfaceContract getBindingInterfaceContract() {
- return serviceContract;
- }
-
- public boolean supportsOneWayInvocation() {
- return false;
- }
-
/**
* Register a Tuscany REST Servlet to handle JAX-RS Resources on a binding endpoint
* @return
@@ -269,7 +303,7 @@ public class RESTServiceBindingProvider implements EndpointProvider {
TuscanyRESTServlet restServlet = new TuscanyRESTServlet(extensionPoints, binding, application.resourceClass);
servletMapping = registerServlet(restServlet);
-
+
RegistrationUtils.registerApplication(application, restServlet.getServletContext());
return application;
} else {
@@ -338,35 +372,4 @@ public class RESTServiceBindingProvider implements EndpointProvider {
}
}
- /**
- * Add specific rest interceptor to invocation chain
- */
- public void configure() {
-
- InvocationChain bindingChain = endpoint.getBindingInvocationChain();
-
- if (wfProvider != null) {
- Interceptor interceptor = wfProvider.createInterceptor();
- if (interceptor != null) {
- bindingChain.addInterceptor(Phase.SERVICE_BINDING_WIREFORMAT, interceptor);
- }
- }
-
- if (wfResponseProvider != null) {
- Interceptor interceptor = wfResponseProvider.createInterceptor();
- if (interceptor != null) {
- bindingChain.addInterceptor(Phase.SERVICE_BINDING_WIREFORMAT, interceptor);
- }
-
- }
-
- if (osProvider != null) {
- Interceptor interceptor = osProvider.createInterceptor();
- if (interceptor != null) {
- bindingChain.addInterceptor(Phase.SERVICE_BINDING_OPERATION_SELECTOR, interceptor);
- }
- }
-
- }
-
}