cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1034076 - in /cxf/branches/2.3.x-fixes: ./ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
Date Thu, 11 Nov 2010 19:41:35 GMT
Author: sergeyb
Date: Thu Nov 11 19:41:34 2010
New Revision: 1034076

URL: http://svn.apache.org/viewvc?rev=1034076&view=rev
Log:
Merged revisions 1034071 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1034071 | sergeyb | 2010-11-11 19:39:19 +0000 (Thu, 11 Nov 2010) | 1 line
  
  JAX-RS: another attempt on breaking the client dependency on the servlet api
........

Modified:
    cxf/branches/2.3.x-fixes/   (props changed)
    cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java

Propchange: cxf/branches/2.3.x-fixes/
------------------------------------------------------------------------------
    svn:mergeinfo = /cxf/trunk:1034071

Propchange: cxf/branches/2.3.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java?rev=1034076&r1=1034075&r2=1034076&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
(original)
+++ cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
Thu Nov 11 19:41:34 2010
@@ -712,6 +712,7 @@ public final class InjectionUtils {
         return value;
     }
     
+    // TODO : investigate the possibility of using generic proxies only
     public static ThreadLocalProxy createThreadLocalProxy(Class<?> type) {
         ThreadLocalProxy proxy = null;
         if (UriInfo.class.isAssignableFrom(type)) {
@@ -728,18 +729,33 @@ public final class InjectionUtils {
             proxy = new ThreadLocalRequest();
         }  else if (Providers.class.isAssignableFrom(type)) {
             proxy = new ThreadLocalProviders();
-        } else if (HttpServletRequest.class.isAssignableFrom(type)) {
+        } else if (SearchContext.class.isAssignableFrom(type)) {
+            proxy = new ThreadLocalSearchContext();
+        } else if (MessageContext.class.isAssignableFrom(type)) {
+            proxy = new ThreadLocalMessageContext();
+        }
+        
+        if (proxy == null && isServletApiContext(type.getName())) {
+            proxy = createThreadLocalServletApiContext(type);  
+        }
+        
+        return proxy;
+    }
+    
+    private static boolean isServletApiContext(String name) { 
+        return name.startsWith("javax.servlet.");
+    }
+    
+    private static ThreadLocalProxy createThreadLocalServletApiContext(Class<?> type)
{
+        ThreadLocalProxy proxy = null;
+        if (HttpServletRequest.class.isAssignableFrom(type)) {
             proxy = new ThreadLocalHttpServletRequest();
         } else if (ServletContext.class.isAssignableFrom(type)) {
             proxy = new ThreadLocalServletContext();
         } else if (HttpServletResponse.class.isAssignableFrom(type)) {
             proxy = new ThreadLocalHttpServletResponse();
-        } else if (MessageContext.class.isAssignableFrom(type)) {
-            proxy = new ThreadLocalMessageContext();
         } else if (ServletConfig.class.isAssignableFrom(type)) {
             proxy = new ThreadLocalServletConfig();
-        } else if (SearchContext.class.isAssignableFrom(type)) {
-            proxy = new ThreadLocalSearchContext();
         }
         return proxy;
     }



Mime
View raw message