Search in sources :

Example 1 with BasicHeaderElement

use of org.apache.http.message.BasicHeaderElement in project robovm by robovm.

the class NetscapeDraftHeaderParser method parseHeader.

public HeaderElement parseHeader(final CharArrayBuffer buffer, final ParserCursor cursor) throws ParseException {
    if (buffer == null) {
        throw new IllegalArgumentException("Char array buffer may not be null");
    }
    if (cursor == null) {
        throw new IllegalArgumentException("Parser cursor may not be null");
    }
    NameValuePair nvp = this.nvpParser.parseNameValuePair(buffer, cursor, DELIMITERS);
    List<NameValuePair> params = new ArrayList<NameValuePair>();
    while (!cursor.atEnd()) {
        NameValuePair param = this.nvpParser.parseNameValuePair(buffer, cursor, DELIMITERS);
        params.add(param);
    }
    return new BasicHeaderElement(nvp.getName(), nvp.getValue(), params.toArray(new NameValuePair[params.size()]));
}
Also used : NameValuePair(org.apache.http.NameValuePair) ArrayList(java.util.ArrayList) BasicHeaderElement(org.apache.http.message.BasicHeaderElement)

Example 2 with BasicHeaderElement

use of org.apache.http.message.BasicHeaderElement in project coprhd-controller by CoprHD.

the class NTLMDecryptedEntity method buildContentTypeHeader.

/**
 * Builds the content type header that would have existed in a decrypted message.
 *
 * @param type
 *            the original content type
 * @param encoding
 *            the original charset
 *
 * @return the new content type header
 */
private Header buildContentTypeHeader(String type, String encoding) {
    NameValuePair[] nvps = new NameValuePair[] { new BasicNameValuePair(NTLMConstants.CHARSET, encoding) };
    BasicHeaderElement elem = new BasicHeaderElement(type, null, nvps);
    return new BasicHeader(HttpHeaders.CONTENT_TYPE, BasicHeaderValueFormatter.formatHeaderElement(elem, false, null));
}
Also used : BasicNameValuePair(org.apache.http.message.BasicNameValuePair) NameValuePair(org.apache.http.NameValuePair) BasicNameValuePair(org.apache.http.message.BasicNameValuePair) BasicHeaderElement(org.apache.http.message.BasicHeaderElement) BasicHeader(org.apache.http.message.BasicHeader)

Example 3 with BasicHeaderElement

use of org.apache.http.message.BasicHeaderElement in project platform_external_apache-http by android.

the class NetscapeDraftHeaderParser method parseHeader.

public HeaderElement parseHeader(final CharArrayBuffer buffer, final ParserCursor cursor) throws ParseException {
    if (buffer == null) {
        throw new IllegalArgumentException("Char array buffer may not be null");
    }
    if (cursor == null) {
        throw new IllegalArgumentException("Parser cursor may not be null");
    }
    NameValuePair nvp = this.nvpParser.parseNameValuePair(buffer, cursor, DELIMITERS);
    List<NameValuePair> params = new ArrayList<NameValuePair>();
    while (!cursor.atEnd()) {
        NameValuePair param = this.nvpParser.parseNameValuePair(buffer, cursor, DELIMITERS);
        params.add(param);
    }
    return new BasicHeaderElement(nvp.getName(), nvp.getValue(), params.toArray(new NameValuePair[params.size()]));
}
Also used : NameValuePair(org.apache.http.NameValuePair) ArrayList(java.util.ArrayList) BasicHeaderElement(org.apache.http.message.BasicHeaderElement)

Example 4 with BasicHeaderElement

use of org.apache.http.message.BasicHeaderElement in project XobotOS by xamarin.

the class NetscapeDraftHeaderParser method parseHeader.

public HeaderElement parseHeader(final CharArrayBuffer buffer, final ParserCursor cursor) throws ParseException {
    if (buffer == null) {
        throw new IllegalArgumentException("Char array buffer may not be null");
    }
    if (cursor == null) {
        throw new IllegalArgumentException("Parser cursor may not be null");
    }
    NameValuePair nvp = this.nvpParser.parseNameValuePair(buffer, cursor, DELIMITERS);
    List<NameValuePair> params = new ArrayList<NameValuePair>();
    while (!cursor.atEnd()) {
        NameValuePair param = this.nvpParser.parseNameValuePair(buffer, cursor, DELIMITERS);
        params.add(param);
    }
    return new BasicHeaderElement(nvp.getName(), nvp.getValue(), params.toArray(new NameValuePair[params.size()]));
}
Also used : NameValuePair(org.apache.http.NameValuePair) ArrayList(java.util.ArrayList) BasicHeaderElement(org.apache.http.message.BasicHeaderElement)

Example 5 with BasicHeaderElement

use of org.apache.http.message.BasicHeaderElement in project coprhd-controller by CoprHD.

the class EncryptingState method buildContentTypeHeader.

/**
 * Builds the new content type header. This is as per NTLM specification.
 *
 * @return the new content type header
 */
private Header buildContentTypeHeader() {
    NameValuePair[] nvps = new NameValuePair[] { new BasicNameValuePair(NTLMConstants.PROTOCOL, NTLMConstants.CONTENT_TYPE_FOR_SPNEGO), new BasicNameValuePair(NTLMConstants.BOUNDARY, BOUNDARY) };
    BasicHeaderElement elem = new BasicHeaderElement(NTLMConstants.CONTENT_TYPE_FOR_MULTIPART_ENCRYPTED, null, nvps);
    return new BasicHeader(HttpHeaders.CONTENT_TYPE, BasicHeaderValueFormatter.formatHeaderElement(elem, false, null));
}
Also used : BasicNameValuePair(org.apache.http.message.BasicNameValuePair) NameValuePair(org.apache.http.NameValuePair) BasicNameValuePair(org.apache.http.message.BasicNameValuePair) BasicHeaderElement(org.apache.http.message.BasicHeaderElement) BasicHeader(org.apache.http.message.BasicHeader)

Aggregations

NameValuePair (org.apache.http.NameValuePair)5 BasicHeaderElement (org.apache.http.message.BasicHeaderElement)5 ArrayList (java.util.ArrayList)3 BasicHeader (org.apache.http.message.BasicHeader)2 BasicNameValuePair (org.apache.http.message.BasicNameValuePair)2