An instance of this class contains all the options for connecting and making requests to the server, including the authentication credentials required for most HTTP requests. This class mainly offers getter and setter methods to manage all the options. More...
Public Member Functions | |
Opts () | |
Opts (JSONObject jso) | |
Opts (String json) | |
Opts (Opts opts) | |
String | getUrl () |
Opts | setUrl (String url) |
boolean | hasSSL () |
Opts | enableSSL (boolean enable) |
boolean | hasAuth () |
String | getAuthId () |
String | getAuthPass () |
boolean | isAuthMaster () |
boolean | hasAuthDevice () |
boolean | hasAuthEmail () |
Opts | setAuth (String id, String pass, boolean master) |
Opts | setAuth (String id, String pass) |
int | getTimeout () |
Opts | setTimeout (int timeout) |
Opts | fromOpts (Opts opts) |
Opts | fromString (String json) |
Opts | fromJSON (String json) |
Opts | fromJSON (JSONObject jso) |
JSONObject | toJSON () |
String | toString () |
Static Public Attributes | |
static final String | K_AUTHID = "authId" |
static final String | K_AUTHPASS = "authPass" |
static final String | K_AUTHMASTER = "authMaster" |
static final String | K_URL = "url" |
static final String | K_TIMEOUT = "timeout" |
static final boolean | DEF_SSL = Const.DEFAULT_URL.startsWith("https") |
static final String | DEF_URL = makeUrl(Const.DEFAULT_URL, DEF_SSL) |
static final int | DEF_TIMEOUT = Const.DEFAULT_TIMEOUT |
static final String | DEF_AUTHID = Const.DEFAULT_AUTHID |
static final String | DEF_AUTHPASS = Const.DEFAULT_AUTHPASS |
static final boolean | DEF_AUTHMASTER = Const.DEFAULT_MASTER |
An instance of this class contains all the options for connecting and making requests to the server, including the authentication credentials required for most HTTP requests. This class mainly offers getter and setter methods to manage all the options.
Opts | ( | ) |
Create a new instance using all the default values.
Opts | ( | JSONObject | jso | ) |
Create a new instance using the options in the specified instance of org.json.JSONObject.
jso | the JSON object to import |
RestException | for invalid argument |
Opts | ( | String | json | ) |
Create a new instance using the options in the specified JSON string.
json | the JSON string to import |
RestException | for invalid argument |
Create a new instance by cloning the specified options
opts | the options to clone |
java.lang.NullPointerException | for null argument |
Opts enableSSL | ( | boolean | enable | ) |
Enable or disable SSL connection by changing the connection URL.
enable | true to enable SSL, false to disable it |
Opts fromJSON | ( | String | json | ) |
Import options from a JSON string.
json | the JSON string to import |
IllegalArgumentException | for invalid JSON |
Opts fromJSON | ( | JSONObject | jso | ) |
Import options from a JSON object.
jso | the org.json.JSONObject to import |
IllegalArgumentException | if fails |
Import options from another Opts
instance.
opts | the options to import |
NullPointerException | if the argument is null |
Opts fromString | ( | String | json | ) |
Alias of fromJSON(String).
json | the JSON string to import |
IllegalArgumentException | for invalid JSON |
String getAuthId | ( | ) |
Authentication identifier getter.
String getAuthPass | ( | ) |
Authentication password getter.
int getTimeout | ( | ) |
Connection timeout getter.
String getUrl | ( | ) |
Connection URL option getter.
boolean hasAuth | ( | ) |
boolean hasAuthDevice | ( | ) |
boolean hasAuthEmail | ( | ) |
boolean hasSSL | ( | ) |
boolean isAuthMaster | ( | ) |
Opts setAuth | ( | String | id, |
String | pass, | ||
boolean | master | ||
) |
Authentication setter.
id | the authentication identifier to set |
pass | the authentication password to set |
master | true if the given pass is a master password |
Opts setAuth | ( | String | id, |
String | pass | ||
) |
Authentication setter using the default master setting.
id | the authentication identifier to set |
pass | the authentication password to set |
Opts setTimeout | ( | int | timeout | ) |
Connection timeout setter.
timeout | the connection timeout (in seconds) to set |
Opts setUrl | ( | String | url | ) |
Connection URL option setter.
url | the new connection URL to use |
RestException | for invalid url |
JSONObject toJSON | ( | ) |
Export this instance as a JSON object.
RestException | if fails |
String toString | ( | ) |
Export this instance as a JSON string.
RestException | if fails |
|
static |
The default authentication identifier.
|
static |
The default master authentication.
|
static |
The default authentication password.
|
static |
The default SSL state: true if enabled, otherwise disabled.
|
static |
The default connection timeout.
|
static |
The default connection url, it is the official CloudPlugs server.
|
static |
Key name of authentication identifier when importing or exporting options to JSON.
|
static |
Key name of master authentication when importing or exporting options to JSON.
|
static |
Key name of authentication password when importing or exporting options to JSON.
|
static |
Key name of connection timeout when importing or exporting options to JSON.
|
static |
Key name of connection url when importing or exporting options to JSON.