You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by ff...@apache.org on 2012/02/24 04:51:15 UTC
svn commit: r1293069 - in /cxf/branches/2.4.x-fixes: ./
rt/transports/common/src/main/java/org/apache/cxf/transport/common/gzip/GZIPOutInterceptor.java
Author: ffang
Date: Fri Feb 24 03:51:15 2012
New Revision: 1293069
URL: http://svn.apache.org/viewvc?rev=1293069&view=rev
Log:
Merged revisions 1293068 via svnmerge from
https://svn.apache.org/repos/asf/cxf/branches/2.5.x-fixes
........
r1293068 | ffang | 2012-02-24 11:42:59 +0800 (δΊ”, 24 2 2012) | 1 line
[CXF-4134]GZIPOutInterceptor compiles Patterns constantly; they should be compiled once and reused
........
Modified:
cxf/branches/2.4.x-fixes/ (props changed)
cxf/branches/2.4.x-fixes/rt/transports/common/src/main/java/org/apache/cxf/transport/common/gzip/GZIPOutInterceptor.java
Propchange: cxf/branches/2.4.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified: cxf/branches/2.4.x-fixes/rt/transports/common/src/main/java/org/apache/cxf/transport/common/gzip/GZIPOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/transports/common/src/main/java/org/apache/cxf/transport/common/gzip/GZIPOutInterceptor.java?rev=1293069&r1=1293068&r2=1293069&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/rt/transports/common/src/main/java/org/apache/cxf/transport/common/gzip/GZIPOutInterceptor.java (original)
+++ cxf/branches/2.4.x-fixes/rt/transports/common/src/main/java/org/apache/cxf/transport/common/gzip/GZIPOutInterceptor.java Fri Feb 24 03:51:15 2012
@@ -70,6 +70,12 @@ public class GZIPOutInterceptor extends
}
/**
+ * regular expression that matches any encoding with a
+ * q-value of 0 (or 0.0, 0.00, etc.).
+ */
+ public static final Pattern ZERO_Q = Pattern.compile(";\\s*q=0(?:\\.0+)?$");
+
+ /**
* Key under which we store the original output stream on the message, for
* use by the ending interceptor.
*/
@@ -188,14 +194,11 @@ public class GZIPOutInterceptor extends
List<String> zeros = new ArrayList<String>(3);
List<String> nonZeros = new ArrayList<String>(3);
- // regular expression that matches any encoding with a
- // q-value of 0 (or 0.0, 0.00, etc.).
- Pattern zeroQ = Pattern.compile(";\\s*q=0(?:\\.0+)?$");
for (String headerLine : acceptEncodingHeader) {
String[] encodings = headerLine.trim().split("[,\\s]*,\\s*");
for (String enc : encodings) {
- Matcher m = zeroQ.matcher(enc);
+ Matcher m = ZERO_Q.matcher(enc);
if (m.find()) {
zeros.add(enc.substring(0, m.start()));
} else if (enc.indexOf(';') >= 0) {