FileDocCategorySizeDatePackage
RequestExpectContinue.javaAPI DocAndroid 1.5 API3071Wed May 06 22:41:10 BST 2009org.apache.http.protocol

RequestExpectContinue

public class RequestExpectContinue extends Object implements HttpRequestInterceptor
A request interceptor that enables the expect-continue handshake.
author
Oleg Kalnichevski
version
$Revision: 573864 $
since
4.0

Fields Summary
Constructors Summary
public RequestExpectContinue()

        super();
    
Methods Summary
public voidprocess(org.apache.http.HttpRequest request, org.apache.http.protocol.HttpContext context)

        if (request == null) {
            throw new IllegalArgumentException("HTTP request may not be null");
        }
        if (request instanceof HttpEntityEnclosingRequest) {
            HttpEntity entity = ((HttpEntityEnclosingRequest)request).getEntity();
            // Do not send the expect header if request body is known to be empty
            if (entity != null && entity.getContentLength() != 0) { 
                ProtocolVersion ver = request.getRequestLine().getProtocolVersion();
                if (HttpProtocolParams.useExpectContinue(request.getParams()) 
                        && !ver.lessEquals(HttpVersion.HTTP_1_0)) {
                    request.addHeader(HTTP.EXPECT_DIRECTIVE, HTTP.EXPECT_CONTINUE);
                }
            }
        }