if (header != null) {
final int space = header.indexOf(' ');
if (space != -1) {
final String scheme = header.substring(0, space);
result = new ChallengeRequest(new ChallengeScheme("HTTP_"
+ scheme, scheme), null);
// Parse the parameters to extract the realm
final String rest = header.substring(space + 1);
parseParameters(rest, result.getParameters());
result.setRealm(result.getParameters().getFirstValue("realm"));
} else {
final String scheme = header.substring(0);
result = new ChallengeRequest(new ChallengeScheme("HTTP_"
+ scheme, scheme), null);
}
}
// Give a chance to the authentication helper to do further parsing