wink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b...@apache.org
Subject svn commit: r822994 - /incubator/wink/trunk/wink-client/src/main/java/org/apache/wink/client/internal/ResourceImpl.java
Date Thu, 08 Oct 2009 01:30:41 GMT
Author: bluk
Date: Thu Oct  8 01:30:41 2009
New Revision: 822994

URL: http://svn.apache.org/viewvc?rev=822994&view=rev
Log:
Insert the ProvidersRegistry into RuntimeContext

See [WINK-192]

Modified:
    incubator/wink/trunk/wink-client/src/main/java/org/apache/wink/client/internal/ResourceImpl.java

Modified: incubator/wink/trunk/wink-client/src/main/java/org/apache/wink/client/internal/ResourceImpl.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-client/src/main/java/org/apache/wink/client/internal/ResourceImpl.java?rev=822994&r1=822993&r2=822994&view=diff
==============================================================================
--- incubator/wink/trunk/wink-client/src/main/java/org/apache/wink/client/internal/ResourceImpl.java
(original)
+++ incubator/wink/trunk/wink-client/src/main/java/org/apache/wink/client/internal/ResourceImpl.java
Thu Oct  8 01:30:41 2009
@@ -43,10 +43,12 @@
 import org.apache.wink.client.handlers.HandlerContext;
 import org.apache.wink.client.internal.handlers.ClientRequestImpl;
 import org.apache.wink.client.internal.handlers.HandlerContextImpl;
+import org.apache.wink.common.RuntimeContext;
 import org.apache.wink.common.http.HttpMethodEx;
 import org.apache.wink.common.internal.CaseInsensitiveMultivaluedMap;
 import org.apache.wink.common.internal.i18n.Messages;
 import org.apache.wink.common.internal.registry.ProvidersRegistry;
+import org.apache.wink.common.internal.runtime.RuntimeContextTLS;
 import org.apache.wink.common.internal.utils.HeaderUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -200,9 +202,16 @@
                                   Class<?> responseEntity,
                                   Type responseEntityType,
                                   Object requestEntity) {
+
         ClientRequest request =
             createClientRequest(method, responseEntity, responseEntityType, requestEntity);
         HandlerContext context = createHandlerContext();
+
+        ProvidersRegistry providersRegistry = request.getAttribute(ProvidersRegistry.class);
+        ClientRuntimeContext runtimeContext = new ClientRuntimeContext(providersRegistry);
+        RuntimeContext saved = RuntimeContextTLS.getRuntimeContext();
+        RuntimeContextTLS.setRuntimeContext(runtimeContext);
+
         try {
             ClientResponse response = context.doChain(request);
             int statusCode = response.getStatusCode();
@@ -217,6 +226,8 @@
             throw e;
         } catch (Exception e) {
             throw new ClientRuntimeException(e);
+        } finally {
+            RuntimeContextTLS.setRuntimeContext(saved);
         }
     }
 



Mime
View raw message