use of org.apache.http.message.HeaderValueParser in project platform_external_apache-http by android.
the class RFC2617Scheme method parseChallenge.
@Override
protected void parseChallenge(final CharArrayBuffer buffer, int pos, int len) throws MalformedChallengeException {
HeaderValueParser parser = BasicHeaderValueParser.DEFAULT;
ParserCursor cursor = new ParserCursor(pos, buffer.length());
HeaderElement[] elements = parser.parseElements(buffer, cursor);
if (elements.length == 0) {
throw new MalformedChallengeException("Authentication challenge is empty");
}
this.params = new HashMap<String, String>(elements.length);
for (HeaderElement element : elements) {
this.params.put(element.getName(), element.getValue());
}
}
use of org.apache.http.message.HeaderValueParser in project XobotOS by xamarin.
the class RFC2617Scheme method parseChallenge.
@Override
protected void parseChallenge(final CharArrayBuffer buffer, int pos, int len) throws MalformedChallengeException {
HeaderValueParser parser = BasicHeaderValueParser.DEFAULT;
ParserCursor cursor = new ParserCursor(pos, buffer.length());
HeaderElement[] elements = parser.parseElements(buffer, cursor);
if (elements.length == 0) {
throw new MalformedChallengeException("Authentication challenge is empty");
}
this.params = new HashMap<String, String>(elements.length);
for (HeaderElement element : elements) {
this.params.put(element.getName(), element.getValue());
}
}
use of org.apache.http.message.HeaderValueParser in project robovm by robovm.
the class RFC2617Scheme method parseChallenge.
@Override
protected void parseChallenge(final CharArrayBuffer buffer, int pos, int len) throws MalformedChallengeException {
HeaderValueParser parser = BasicHeaderValueParser.DEFAULT;
ParserCursor cursor = new ParserCursor(pos, buffer.length());
HeaderElement[] elements = parser.parseElements(buffer, cursor);
if (elements.length == 0) {
throw new MalformedChallengeException("Authentication challenge is empty");
}
this.params = new HashMap<String, String>(elements.length);
for (HeaderElement element : elements) {
this.params.put(element.getName(), element.getValue());
}
}
use of org.apache.http.message.HeaderValueParser in project android-delicious by lexs.
the class Response method getCharset.
public String getCharset() {
String contentType = connection.getContentType();
if (contentType != null) {
HeaderValueParser parser = new BasicHeaderValueParser();
HeaderElement[] values = BasicHeaderValueParser.parseElements(contentType, parser);
if (values.length > 0) {
NameValuePair param = values[0].getParameterByName("charset");
if (param != null) {
return param.getValue();
}
}
}
// No encoding specified
return HTTP.DEFAULT_CONTENT_CHARSET;
}
Aggregations