cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject git commit: [CXF-5717] Checking registered Param converters
Date Wed, 30 Apr 2014 11:02:05 GMT
Repository: cxf
Updated Branches:
  refs/heads/master fc4f04e39 -> a5be50145


[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/a5be5014
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/a5be5014
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/a5be5014

Branch: refs/heads/master
Commit: a5be50145737273c5694f05409d065b98dfa2e22
Parents: fc4f04e
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:01:46 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/a5be5014/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 193097c..2a3114c 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
@@ -92,7 +92,6 @@ import org.apache.cxf.jaxrs.provider.ServerProviderFactory;
 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 {
     
@@ -1254,12 +1253,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