417284 Precompiled regex in HttpField

This commit is contained in:
Greg Wilkins 2013-09-23 15:19:41 +10:00
parent 857d534d8d
commit 4708c907c1
1 changed files with 6 additions and 4 deletions

View File

@ -21,6 +21,7 @@ package org.eclipse.jetty.http;
import java.nio.ByteBuffer;
import java.util.HashSet;
import java.util.Set;
import java.util.regex.Pattern;
import org.eclipse.jetty.util.ArrayTrie;
import org.eclipse.jetty.util.BufferUtil;
@ -100,7 +101,8 @@ public class HttpField
CACHE.put(new HttpField(HttpHeader.AUTHORIZATION,(String)null));
CACHE.put(new HttpField(HttpHeader.COOKIE,(String)null));
}
private final static Pattern __splitter = Pattern.compile("\\s*,\\s*");
private final static byte[] __colon_space = new byte[] {':',' '};
private final HttpHeader _header;
@ -153,10 +155,10 @@ public class HttpField
if (value.equalsIgnoreCase(_value))
return true;
String[] split = _value.split("\\s*,\\s*");
for (String s : split)
String[] split = __splitter.split(_value);
for (int i = 0; split!=null && i < split.length; i++)
{
if (value.equalsIgnoreCase(s))
if (value.equalsIgnoreCase(split[i]))
return true;
}