Package com.castlabs.android.network
Class UserAgent
- java.lang.Object
-
- com.castlabs.android.network.UserAgent
-
public class UserAgent extends Object
Instances of this class are used to construct the user agent that is used for HTTP requests. Additional key/value properties can be registered usingregister(String, String)
. Since version 4.0.1 this class strips non-ASCII characters from the User-Agent by default. You can disable this behaviour by setting- Since:
- 3.0.0
-
-
Field Summary
Fields Modifier and Type Field Description static boolean
STRIP_NON_ASCII_CHARACTERS
By default, the UserAgent string will be stripped and all non-ASCII characters will be removed.
-
Constructor Summary
Constructors Constructor Description UserAgent()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
register(String key, String value)
Register an additional key value pair that will be added to the user agent string representationString
toString()
-
-
-
Field Detail
-
STRIP_NON_ASCII_CHARACTERS
public static boolean STRIP_NON_ASCII_CHARACTERS
By default, the UserAgent string will be stripped and all non-ASCII characters will be removed. You can set this flag totrue
to disable the filter. Please note that some HTTP stacks, especially the one used by OkHttp do not allow non-ASCII characters in the User Agent and you will get an Exception if you change the behaviour.- Since:
- 4.0.1
-
-