Search in sources :

Example 56 with CharArrayBuffer

use of org.apache.http.util.CharArrayBuffer in project platform_external_apache-http by android.

the class BasicHeaderValueParser method parseElements.

// public default constructor
/**
     * Parses elements with the given parser.
     *
     * @param value     the header value to parse
     * @param parser    the parser to use, or <code>null</code> for default
     *
     * @return  array holding the header elements, never <code>null</code>
     */
public static final HeaderElement[] parseElements(final String value, HeaderValueParser parser) throws ParseException {
    if (value == null) {
        throw new IllegalArgumentException("Value to parse may not be null");
    }
    if (parser == null)
        parser = BasicHeaderValueParser.DEFAULT;
    CharArrayBuffer buffer = new CharArrayBuffer(value.length());
    buffer.append(value);
    ParserCursor cursor = new ParserCursor(0, value.length());
    return parser.parseElements(buffer, cursor);
}
Also used : CharArrayBuffer(org.apache.http.util.CharArrayBuffer)

Example 57 with CharArrayBuffer

use of org.apache.http.util.CharArrayBuffer in project platform_external_apache-http by android.

the class BasicHeaderValueParser method parseParameters.

/**
     * Parses parameters with the given parser.
     *
     * @param value     the parameter list to parse
     * @param parser    the parser to use, or <code>null</code> for default
     *
     * @return  array holding the parameters, never <code>null</code>
     */
public static final NameValuePair[] parseParameters(final String value, HeaderValueParser parser) throws ParseException {
    if (value == null) {
        throw new IllegalArgumentException("Value to parse may not be null");
    }
    if (parser == null)
        parser = BasicHeaderValueParser.DEFAULT;
    CharArrayBuffer buffer = new CharArrayBuffer(value.length());
    buffer.append(value);
    ParserCursor cursor = new ParserCursor(0, value.length());
    return parser.parseParameters(buffer, cursor);
}
Also used : CharArrayBuffer(org.apache.http.util.CharArrayBuffer)

Example 58 with CharArrayBuffer

use of org.apache.http.util.CharArrayBuffer in project platform_external_apache-http by android.

the class BasicLineFormatter method formatStatusLine.

// non-javadoc, see interface LineFormatter
public CharArrayBuffer formatStatusLine(final CharArrayBuffer buffer, final StatusLine statline) {
    if (statline == null) {
        throw new IllegalArgumentException("Status line may not be null");
    }
    CharArrayBuffer result = initBuffer(buffer);
    doFormatStatusLine(result, statline);
    return result;
}
Also used : CharArrayBuffer(org.apache.http.util.CharArrayBuffer)

Example 59 with CharArrayBuffer

use of org.apache.http.util.CharArrayBuffer in project platform_external_apache-http by android.

the class HttpRequestWriter method writeHeadLine.

protected void writeHeadLine(final HttpMessage message) throws IOException {
    final CharArrayBuffer buffer = lineFormatter.formatRequestLine(this.lineBuf, ((HttpRequest) message).getRequestLine());
    this.sessionBuffer.writeLine(buffer);
}
Also used : CharArrayBuffer(org.apache.http.util.CharArrayBuffer)

Example 60 with CharArrayBuffer

use of org.apache.http.util.CharArrayBuffer in project platform_external_apache-http by android.

the class BrowserCompatSpec method formatCookies.

public List<Header> formatCookies(final List<Cookie> cookies) {
    if (cookies == null) {
        throw new IllegalArgumentException("List of cookies may not be null");
    }
    if (cookies.isEmpty()) {
        throw new IllegalArgumentException("List of cookies may not be empty");
    }
    CharArrayBuffer buffer = new CharArrayBuffer(20 * cookies.size());
    buffer.append(SM.COOKIE);
    buffer.append(": ");
    for (int i = 0; i < cookies.size(); i++) {
        Cookie cookie = cookies.get(i);
        if (i > 0) {
            buffer.append("; ");
        }
        buffer.append(cookie.getName());
        buffer.append("=");
        String s = cookie.getValue();
        if (s != null) {
            buffer.append(s);
        }
    }
    List<Header> headers = new ArrayList<Header>(1);
    headers.add(new BufferedHeader(buffer));
    return headers;
}
Also used : ClientCookie(org.apache.http.cookie.ClientCookie) Cookie(org.apache.http.cookie.Cookie) BufferedHeader(org.apache.http.message.BufferedHeader) Header(org.apache.http.Header) FormattedHeader(org.apache.http.FormattedHeader) BufferedHeader(org.apache.http.message.BufferedHeader) CharArrayBuffer(org.apache.http.util.CharArrayBuffer) ArrayList(java.util.ArrayList)

Aggregations

CharArrayBuffer (org.apache.http.util.CharArrayBuffer)126 BufferedHeader (org.apache.http.message.BufferedHeader)27 FormattedHeader (org.apache.http.FormattedHeader)24 Header (org.apache.http.Header)21 ArrayList (java.util.ArrayList)19 ClientCookie (org.apache.http.cookie.ClientCookie)12 Cookie (org.apache.http.cookie.Cookie)12 ParserCursor (org.apache.http.message.ParserCursor)11 Headers (android.net.http.Headers)6 IOException (java.io.IOException)6 MalformedChallengeException (org.apache.http.auth.MalformedChallengeException)6 MalformedCookieException (org.apache.http.cookie.MalformedCookieException)6 AuthenticationException (org.apache.http.auth.AuthenticationException)5 InvalidCredentialsException (org.apache.http.auth.InvalidCredentialsException)5 BasicNameValuePair (org.apache.http.message.BasicNameValuePair)5 NTCredentials (org.apache.http.auth.NTCredentials)4 HashMap (java.util.HashMap)3 HeaderElement (org.apache.http.HeaderElement)3 NoHttpResponseException (org.apache.http.NoHttpResponseException)3 ParseException (org.apache.http.ParseException)3