## org.apache.http.params
Class HttpProtocolParams

    java.lang.Object
      org.apache.http.params.HttpProtocolParams

All Implemented Interfaces:
  CoreProtocolPNames

    public final class HttpProtocolParams

extends Object
implements CoreProtocolPNames

Utility class for accessing protocol parameters in `HttpParams`.

Since:
  4.0
See Also:
  `CoreProtocolPNames`

Field Summary

Fields inherited from interface org.apache.http.params.CoreProtocolPNames
`HTTP_CONTENT_CHARSET, HTTP_ELEMENT_CHARSET, HTTP_MALFORMED_INPUT_ACTION, HTTP_UNMAPPABLE_INPUT_ACTION, ORIGIN_SERVER, PROTOCOL_VERSION, STRICT_TRANSFER_ENCODING, USE_EXPECT_CONTINUE, USER_AGENT, WAIT_FOR_CONTINUE`

Method Summary
`static String` `getContentCharset(HttpParams params)` Obtains value of the `CoreProtocolPNames.HTTP_CONTENT_CHARSET` parameter.
`static String` `getHttpElementCharset(HttpParams params)` Obtains value of the `CoreProtocolPNames.HTTP_ELEMENT_CHARSET` parameter.
`static CodingErrorAction` `getMalformedInputAction(HttpParams params)` Obtains value of the `CoreProtocolPNames.HTTP_MALFORMED_INPUT_ACTION` parameter.
`static CodingErrorAction` `getUnmappableInputAction(HttpParams params)` Obtains the value of the `CoreProtocolPNames.HTTP_UNMAPPABLE_INPUT_ACTION` parameter.
`static String` `getUserAgent(HttpParams params)` Obtains value of the `CoreProtocolPNames.USER_AGENT` parameter.
`static ProtocolVersion` `getVersion(HttpParams params)` Obtains value of the `CoreProtocolPNames.PROTOCOL_VERSION` parameter.
`static void` `setContentCharset(HttpParams params, String charset)` Sets value of the `CoreProtocolPNames.HTTP_CONTENT_CHARSET` parameter.
`static void` `setHttpElementCharset(HttpParams params, String charset)` Sets value of the `CoreProtocolPNames.HTTP_ELEMENT_CHARSET` parameter.
`static void` `setMalformedInputAction(HttpParams params, CodingErrorAction action)` Sets value of the `CoreProtocolPNames.HTTP_MALFORMED_INPUT_ACTION` parameter.
`static void` `setUnmappableInputAction(HttpParams params, CodingErrorAction action)` Sets the value of the `CoreProtocolPNames.HTTP_UNMAPPABLE_INPUT_ACTION` parameter.
`static void` `setUseExpectContinue(HttpParams params, boolean b)` Sets value of the `CoreProtocolPNames.USE_EXPECT_CONTINUE` parameter.
`static void` `setUserAgent(HttpParams params, String useragent)` Sets value of the `CoreProtocolPNames.USER_AGENT` parameter.
`static void` `setVersion(HttpParams params, ProtocolVersion version)` Sets value of the `CoreProtocolPNames.PROTOCOL_VERSION` parameter.
`static boolean` `useExpectContinue(HttpParams params)` Obtains value of the `CoreProtocolPNames.USE_EXPECT_CONTINUE` parameter.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### getHttpElementCharset

    public static String getHttpElementCharset(HttpParams params)

  Obtains value of the `CoreProtocolPNames.HTTP_ELEMENT_CHARSET` parameter. If not set, defaults to `US-ASCII`.

  Parameters:
    `params` - HTTP parameters.
  Returns:
    HTTP element charset.

### setHttpElementCharset

    public static void setHttpElementCharset(HttpParams params,
                                             String charset)

  Sets value of the `CoreProtocolPNames.HTTP_ELEMENT_CHARSET` parameter.

  Parameters:
    `params` - HTTP parameters.
    `charset` - HTTP element charset.

### getContentCharset

    public static String getContentCharset(HttpParams params)

  Obtains value of the `CoreProtocolPNames.HTTP_CONTENT_CHARSET` parameter. If not set, defaults to `ISO-8859-1`.

  Parameters:
    `params` - HTTP parameters.
  Returns:
    HTTP content charset.

### setContentCharset

    public static void setContentCharset(HttpParams params,
                                         String charset)

  Sets value of the `CoreProtocolPNames.HTTP_CONTENT_CHARSET` parameter.

  Parameters:
    `params` - HTTP parameters.
    `charset` - HTTP content charset.

### getVersion

    public static ProtocolVersion getVersion(HttpParams params)

  Obtains value of the `CoreProtocolPNames.PROTOCOL_VERSION` parameter. If not set, defaults to `HttpVersion.HTTP_1_1`.

  Parameters:
    `params` - HTTP parameters.
  Returns:
    HTTP protocol version.

### setVersion

    public static void setVersion(HttpParams params,
                                  ProtocolVersion version)

  Sets value of the `CoreProtocolPNames.PROTOCOL_VERSION` parameter.

  Parameters:
    `params` - HTTP parameters.
    `version` - HTTP protocol version.

### getUserAgent

    public static String getUserAgent(HttpParams params)

  Obtains value of the `CoreProtocolPNames.USER_AGENT` parameter. If not set, returns `null`.

  Parameters:
    `params` - HTTP parameters.
  Returns:
    User agent string.

### setUserAgent

    public static void setUserAgent(HttpParams params,
                                    String useragent)

  Sets value of the `CoreProtocolPNames.USER_AGENT` parameter.

  Parameters:
    `params` - HTTP parameters.
    `useragent` - User agent string.

### useExpectContinue

    public static boolean useExpectContinue(HttpParams params)

  Obtains value of the `CoreProtocolPNames.USE_EXPECT_CONTINUE` parameter. If not set, returns `false`.

  Parameters:
    `params` - HTTP parameters.
  Returns:
    User agent string.

### setUseExpectContinue

    public static void setUseExpectContinue(HttpParams params,
                                            boolean b)

  Sets value of the `CoreProtocolPNames.USE_EXPECT_CONTINUE` parameter.

  Parameters:
    `params` - HTTP parameters.
    `b` - expect-continue flag.

### getMalformedInputAction

    public static CodingErrorAction getMalformedInputAction(HttpParams params)

  Obtains value of the `CoreProtocolPNames.HTTP_MALFORMED_INPUT_ACTION` parameter.

  Parameters:
    `params` - HTTP parameters.
  Returns:
    Action to perform upon receiving a malformed input
  Since:
    4.2

### setMalformedInputAction

    public static void setMalformedInputAction(HttpParams params,
                                               CodingErrorAction action)

  Sets value of the `CoreProtocolPNames.HTTP_MALFORMED_INPUT_ACTION` parameter.

  Parameters:
    `params` - HTTP parameters
    `action` - action to perform on malformed inputs
  Since:
    4.2

### getUnmappableInputAction

    public static CodingErrorAction getUnmappableInputAction(HttpParams params)

  Obtains the value of the `CoreProtocolPNames.HTTP_UNMAPPABLE_INPUT_ACTION` parameter.

  Parameters:
    `params` - HTTP parameters
  Returns:
    Action to perform upon receiving a unmapped input
  Since:
    4.2

### setUnmappableInputAction

    public static void setUnmappableInputAction(HttpParams params,
                                                CodingErrorAction action)

  Sets the value of the `CoreProtocolPNames.HTTP_UNMAPPABLE_INPUT_ACTION` parameter.

  Parameters:
    `params` - HTTP parameters
    `action` - action to perform on un mappable inputs
  Since:
    4.2

Copyright © 2005-2013 The Apache Software Foundation. All Rights Reserved.