Scanner acceptHeaderScanner = new Scanner(headerValue);
acceptHeaderScanner.useDelimiter(",\\s?");
while (acceptHeaderScanner.hasNext()) {
if (acceptHeaderScanner.hasNext(REG_EX_ACCEPT_WITH_Q_FACTOR)) {
acceptHeaderScanner.next(REG_EX_ACCEPT_WITH_Q_FACTOR);
MatchResult result = acceptHeaderScanner.match();
if (result.groupCount() == 2) {
String acceptHeaderValue = result.group(1);
double qualityFactor = result.group(2) != null ? Double.parseDouble(result.group(2)) : 1d;
qualityFactor = getQualityFactor(acceptHeaderValue, qualityFactor);
Accept acceptHeader = new Accept().setQuality(qualityFactor).setValue(acceptHeaderValue);