cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject [1/2] git commit: [CXF-5717] Checking registered Param converters
Date Wed, 30 Apr 2014 11:08:57 GMT
Repository: cxf
Updated Branches:
  refs/heads/2.7.x-fixes 715d24acf -> 48f3aea57


[CXF-5717] Checking registered Param converters


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/87c8b088
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/87c8b088
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/87c8b088

Branch: refs/heads/2.7.x-fixes
Commit: 87c8b08876c9c6e0e22327480bfea259b6e28b72
Parents: 715d24a
Author: Sergey Beryozkin <sberyozkin@talend.com>
Authored: Wed Apr 30 12:01:46 2014 +0100
Committer: Sergey Beryozkin <sberyozkin@talend.com>
Committed: Wed Apr 30 12:04:39 2014 +0100

----------------------------------------------------------------------
 .../java/org/apache/cxf/jaxrs/utils/InjectionUtils.java | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/87c8b088/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
index ed7a913..9a5600f 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
@@ -94,7 +94,6 @@ import org.apache.cxf.jaxrs.provider.ProviderFactory;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageUtils;
-import org.apache.cxf.phase.PhaseInterceptorChain;
 
 public final class InjectionUtils {
     
@@ -1250,12 +1249,21 @@ public final class InjectionUtils {
         }
     }
     public static Object convertStringToPrimitive(String value, Class<?> cls) {
+        return convertStringToPrimitive(value, cls, new Annotation[]{});
+    }
+    public static Object convertStringToPrimitive(String value, Class<?> cls, Annotation[]
anns) {
+        Message m = JAXRSUtils.getCurrentMessage();
+        if (m != null) {
+            ParamConverter<?> pc = ServerProviderFactory.getInstance(m).createParameterHandler(cls,
anns);
+            if (pc != null) {
+                return pc.fromString(value);
+            }
+        }
         if (String.class == cls) {
             return value;
         } else if (cls.isPrimitive()) {
             return PrimitiveUtils.read(value, cls);
         } else if (cls.isEnum()) {
-            Message m = PhaseInterceptorChain.getCurrentMessage();
             if (m == null || !MessageUtils.getContextualBoolean(m, ENUM_CONVERSION_CASE_SENSITIVE,
false)) {
                 value = value.toUpperCase();
             }


Mime
View raw message