Search in sources :

Example 96 with CharArrayBuffer

use of org.apache.http.util.CharArrayBuffer in project XobotOS by xamarin.

the class RFC2109Spec method doFormatOneHeader.

private List<Header> doFormatOneHeader(final List<Cookie> cookies) {
    int version = Integer.MAX_VALUE;
    // Pick the lowest common denominator
    for (Cookie cookie : cookies) {
        if (cookie.getVersion() < version) {
            version = cookie.getVersion();
        }
    }
    CharArrayBuffer buffer = new CharArrayBuffer(40 * cookies.size());
    buffer.append(SM.COOKIE);
    buffer.append(": ");
    buffer.append("$Version=");
    buffer.append(Integer.toString(version));
    for (Cookie cooky : cookies) {
        buffer.append("; ");
        Cookie cookie = cooky;
        formatCookieAsVer(buffer, cookie, version);
    }
    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) BufferedHeader(org.apache.http.message.BufferedHeader) CharArrayBuffer(org.apache.http.util.CharArrayBuffer) ArrayList(java.util.ArrayList)

Example 97 with CharArrayBuffer

use of org.apache.http.util.CharArrayBuffer in project XobotOS by xamarin.

the class RFC2109Spec method doFormatManyHeaders.

private List<Header> doFormatManyHeaders(final List<Cookie> cookies) {
    List<Header> headers = new ArrayList<Header>(cookies.size());
    for (Cookie cookie : cookies) {
        int version = cookie.getVersion();
        CharArrayBuffer buffer = new CharArrayBuffer(40);
        buffer.append("Cookie: ");
        buffer.append("$Version=");
        buffer.append(Integer.toString(version));
        buffer.append("; ");
        formatCookieAsVer(buffer, cookie, version);
        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) BufferedHeader(org.apache.http.message.BufferedHeader) ArrayList(java.util.ArrayList) CharArrayBuffer(org.apache.http.util.CharArrayBuffer)

Example 98 with CharArrayBuffer

use of org.apache.http.util.CharArrayBuffer in project XobotOS by xamarin.

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 99 with CharArrayBuffer

use of org.apache.http.util.CharArrayBuffer in project XobotOS by xamarin.

the class HttpResponseWriter method writeHeadLine.

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

Example 100 with CharArrayBuffer

use of org.apache.http.util.CharArrayBuffer in project XobotOS by xamarin.

the class BasicHeaderElement method toString.

public String toString() {
    CharArrayBuffer buffer = new CharArrayBuffer(64);
    buffer.append(this.name);
    if (this.value != null) {
        buffer.append("=");
        buffer.append(this.value);
    }
    for (int i = 0; i < this.parameters.length; i++) {
        buffer.append("; ");
        buffer.append(this.parameters[i]);
    }
    return buffer.toString();
}
Also used : CharArrayBuffer(org.apache.http.util.CharArrayBuffer)

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