cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1235730 - /cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
Date Wed, 25 Jan 2012 13:09:42 GMT
Author: sergeyb
Date: Wed Jan 25 13:09:41 2012
New Revision: 1235730

URL: http://svn.apache.org/viewvc?rev=1235730&view=rev
Log:
[CXF-4055] Optionally checking ParameterHandlers first

Modified:
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java?rev=1235730&r1=1235729&r2=1235730&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
Wed Jan 25 13:09:41 2012
@@ -37,6 +37,7 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.LinkedHashMap;
@@ -88,6 +89,7 @@ import org.apache.cxf.jaxrs.model.Parame
 import org.apache.cxf.jaxrs.model.ParameterType;
 import org.apache.cxf.jaxrs.provider.ProviderFactory;
 import org.apache.cxf.message.Message;
+import org.apache.cxf.message.MessageUtils;
 
 public final class InjectionUtils {
     
@@ -99,6 +101,8 @@ public final class InjectionUtils {
     private static final String HTTP_SERVLET_REQUEST_CLASS_NAME = "javax.servlet.http.HttpServletRequest";
     private static final String HTTP_SERVLET_RESPONSE_CLASS_NAME = "javax.servlet.http.HttpServletResponse";
         
+    private static final String PARAM_HANDLERS_FIRST = "check.parameter.handlers.first";
+    
     private InjectionUtils() {
         
     }
@@ -382,12 +386,10 @@ public final class InjectionUtils {
 
     private static <T> T instantiateFromParameterHandler(String value, 
                                                      Class<T> pClass,
-                                                     Message message) {
-        // TODO: Consider always checking custom parameter handlers first.
-        // Right now, Locale and Date are two special cases so it's very cheap
-        // just to check if it is Locale or not; 
-        if (Locale.class == pClass) {
-            return createFromParameterHandler(value, pClass, message);
+                                                     Message m) {
+        if (Date.class == pClass || Locale.class == pClass 
+            || m != null && MessageUtils.isTrue(m.getContextualProperty(PARAM_HANDLERS_FIRST)))
{
+            return createFromParameterHandler(value, pClass, m);
         } else {
             return null;
         }



Mime
View raw message