FileDocCategorySizeDatePackage
HttpProtocolParams.javaAPI DocAndroid 1.5 API6534Wed May 06 22:41:10 BST 2009org.apache.http.params

HttpProtocolParams

public final class HttpProtocolParams extends Object implements CoreProtocolPNames
This class implements an adaptor around the {@link HttpParams} interface to simplify manipulation of the HTTP protocol specific parameters.
Note that the implements relation to {@link CoreProtocolPNames} is for compatibility with existing application code only. References to the parameter names should use the interface, not this class.
author
Oleg Kalnichevski
version
$Revision: 576089 $
since
4.0
see
CoreProtocolPNames

Fields Summary
Constructors Summary
private HttpProtocolParams()

        super();
    
Methods Summary
public static java.lang.StringgetContentCharset(org.apache.http.params.HttpParams params)
Returns the default charset to be used for writing content body, when no charset explicitly specified.

return
The charset

        if (params == null) {
            throw new IllegalArgumentException("HTTP parameters may not be null");
        }
        String charset = (String) params.getParameter
            (CoreProtocolPNames.HTTP_CONTENT_CHARSET);
        if (charset == null) {
            charset = HTTP.DEFAULT_CONTENT_CHARSET;
        }
        return charset;
    
public static java.lang.StringgetHttpElementCharset(org.apache.http.params.HttpParams params)
Returns the charset to be used for writing HTTP headers.

return
The charset

        if (params == null) {
            throw new IllegalArgumentException("HTTP parameters may not be null");
        }
        String charset = (String) params.getParameter
            (CoreProtocolPNames.HTTP_ELEMENT_CHARSET);
        if (charset == null) {
            charset = HTTP.DEFAULT_PROTOCOL_CHARSET;
        }
        return charset;
    
public static java.lang.StringgetUserAgent(org.apache.http.params.HttpParams params)

 
        if (params == null) {
            throw new IllegalArgumentException("HTTP parameters may not be null");
        }
        return (String) params.getParameter(CoreProtocolPNames.USER_AGENT);
    
public static org.apache.http.ProtocolVersiongetVersion(org.apache.http.params.HttpParams params)
Returns {@link ProtocolVersion protocol version} to be used per default.

return
{@link ProtocolVersion protocol version}

 
        if (params == null) {
            throw new IllegalArgumentException("HTTP parameters may not be null");
        }
        Object param = params.getParameter
            (CoreProtocolPNames.PROTOCOL_VERSION);
        if (param == null) {
            return HttpVersion.HTTP_1_1;
        }
        return (ProtocolVersion)param;
    
public static voidsetContentCharset(org.apache.http.params.HttpParams params, java.lang.String charset)
Sets the default charset to be used for writing content body, when no charset explicitly specified.

param
charset The charset

        if (params == null) {
            throw new IllegalArgumentException("HTTP parameters may not be null");
        }
        params.setParameter(CoreProtocolPNames.HTTP_CONTENT_CHARSET, charset);
    
public static voidsetHttpElementCharset(org.apache.http.params.HttpParams params, java.lang.String charset)
Sets the charset to be used for writing HTTP headers.

param
charset The charset

        if (params == null) {
            throw new IllegalArgumentException("HTTP parameters may not be null");
        }
        params.setParameter(CoreProtocolPNames.HTTP_ELEMENT_CHARSET, charset);
    
public static voidsetUseExpectContinue(org.apache.http.params.HttpParams params, boolean b)

        if (params == null) {
            throw new IllegalArgumentException("HTTP parameters may not be null");
        }
        params.setBooleanParameter(CoreProtocolPNames.USE_EXPECT_CONTINUE, b);
    
public static voidsetUserAgent(org.apache.http.params.HttpParams params, java.lang.String useragent)

        if (params == null) {
            throw new IllegalArgumentException("HTTP parameters may not be null");
        }
        params.setParameter(CoreProtocolPNames.USER_AGENT, useragent);
    
public static voidsetVersion(org.apache.http.params.HttpParams params, org.apache.http.ProtocolVersion version)
Assigns the {@link ProtocolVersion protocol version} to be used by the HTTP methods that this collection of parameters applies to.

param
version the {@link ProtocolVersion protocol version}

        if (params == null) {
            throw new IllegalArgumentException("HTTP parameters may not be null");
        }
        params.setParameter(CoreProtocolPNames.PROTOCOL_VERSION, version);
    
public static booleanuseExpectContinue(org.apache.http.params.HttpParams params)

        if (params == null) {
            throw new IllegalArgumentException("HTTP parameters may not be null");
        }
        return params.getBooleanParameter
            (CoreProtocolPNames.USE_EXPECT_CONTINUE, false);