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

RequestUserAgent

public class RequestUserAgent extends Object implements HttpRequestInterceptor
A request interceptor that adds a User-Agent header.
author
Oleg Kalnichevski
version
$Revision: 496070 $
since
4.0

Fields Summary
Constructors Summary
public RequestUserAgent()

        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.containsHeader(HTTP.USER_AGENT)) {
            String useragent = HttpProtocolParams.getUserAgent(request.getParams());
            if (useragent != null) {
                request.addHeader(HTTP.USER_AGENT, useragent);
            }
        }