cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject [2/3] cxf git commit: [CXF-6850]:javax.ws.rs.core.Request implementation doesn't match Accept-Encoding: * for any encoding value
Date Wed, 30 Mar 2016 12:14:10 GMT
[CXF-6850]:javax.ws.rs.core.Request implementation doesn't match Accept-Encoding: * for any
encoding value


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

Branch: refs/heads/3.1.x-fixes
Commit: f9a36aa808d0908aee41890c2a21c26106cc9ac5
Parents: b133237
Author: Jim Ma <ema@apache.org>
Authored: Wed Mar 30 15:42:13 2016 +0800
Committer: Jim Ma <ema@apache.org>
Committed: Wed Mar 30 20:00:53 2016 +0800

----------------------------------------------------------------------
 .../java/org/apache/cxf/jaxrs/impl/RequestImpl.java   | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/f9a36aa8/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/RequestImpl.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/RequestImpl.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/RequestImpl.java
index a728caf..e5ee091 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/RequestImpl.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/RequestImpl.java
@@ -90,7 +90,7 @@ public class RequestImpl implements Request {
             }
             
             boolean encMatched = acceptEncs.isEmpty() || enc == null 
-                || acceptEncs.contains(enc);
+                || isEncMatached(acceptEncs, enc);;
             if (encMatched) {
                 handleVaryValues(varyValues, HttpHeaders.ACCEPT_ENCODING);
             }
@@ -148,6 +148,18 @@ public class RequestImpl implements Request {
         return false;
     }
 
+    private static boolean isEncMatached(List<String> accepts, String enc) {
+        if (accepts.contains(enc)) {
+            return true;
+        }
+        for (String accept : accepts) {
+            if ("*".equals(accept)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
     private static List<String> parseAcceptEnc(String acceptEnc) {
         if (StringUtils.isEmpty(acceptEnc)) {
             return Collections.emptyList();


Mime
View raw message