public class DataSiftConfig extends Object
| Modifier and Type | Field and Description |
|---|---|
protected String |
apiKey |
protected boolean |
compatibleSSLProtocolsFound |
protected int |
connectTimeout |
protected String |
host |
protected io.higgs.http.client.HttpRequestBuilder |
http
This instance should be used as a base for configurations.
|
protected boolean |
manualPort |
protected int |
port |
protected boolean |
sslEnabled |
protected List<String> |
sslProtocols |
protected String |
urlEncodingFormat |
protected String |
username |
protected String |
versionPrefix |
protected String |
wsHost |
| Constructor and Description |
|---|
DataSiftConfig() |
DataSiftConfig(String username,
String apiKey)
Initialize a new config instance with the given username and api key
|
| Modifier and Type | Method and Description |
|---|---|
DataSiftConfig |
auth(String username,
String apiKey)
Provide the user credentials that should be used for authentication
|
String |
authAsHeader() |
URI |
baseURL() |
boolean |
compatibleSSLProtocolsFound() |
int |
connectTimeout() |
void |
connectTimeout(int connectTimeout) |
String |
getApiKey() |
String |
getClientVersion() |
String |
getUsername() |
String |
host() |
DataSiftConfig |
host(String host) |
io.higgs.http.client.HttpRequestBuilder |
http() |
boolean |
isAutoReconnect() |
boolean |
isSslEnabled() |
URI |
newAPIEndpointURI(String endpoint)
Generate a new URI object given an endpoint relative to the base url of this configuration.
|
URI |
newAPIEndpointURI(URI endpoint)
Generate a new URI object given an endpoint relative to the base url of this configuration.
|
int |
port() |
void |
port(int p) |
String |
protocol() |
DataSiftConfig |
proxy(String host,
int port)
Sets a host and port for a proxy that all requests should be sent to
|
DataSiftConfig |
proxy(String host,
int port,
String username,
String password) |
void |
setAutoReconnect(boolean autoReconnect)
Sets whether streams are automatically reconnected when a websocket connection is closed
|
void |
setSslEnabled(boolean sslEnabled) |
String[] |
sslProtocols()
Gets an array of compatible SSL protocols found on this JVM
|
String |
urlEncodingFormat() |
DataSiftConfig |
urlEncodingFormat(String format)
Sets the format that should be used to encode URL parameters when the option arises
e.g.
|
String |
versionPrefix() |
String |
wsHost() |
DataSiftConfig |
wsHost(String host) |
protected boolean compatibleSSLProtocolsFound
protected String username
protected String apiKey
protected boolean sslEnabled
protected String host
protected String wsHost
protected io.higgs.http.client.HttpRequestBuilder http
HttpRequestBuilder.copy()
Although a single instance would work, this keeps things simple and ensures no stale data is passed in
subsequent requests.
It is also very cheap in terms of Netty's thread usage because Higgs re-uses the same event loop group
so it'll never be creating a whole new load of resources for each instance.protected String versionPrefix
protected String urlEncodingFormat
protected int port
protected boolean manualPort
protected int connectTimeout
public DataSiftConfig auth(String username, String apiKey)
username - the DataSift usernameapiKey - the DataSift API keypublic DataSiftConfig proxy(String host, int port)
host - proxy hostport - proxy portpublic DataSiftConfig proxy(String host, int port, String username, String password)
username - the username the proxy requirespassword - the password the proxy requirespublic String protocol()
public DataSiftConfig host(String host)
public String host()
public DataSiftConfig wsHost(String host)
public String wsHost()
public int port()
public void port(int p)
public URI baseURL()
public URI newAPIEndpointURI(String endpoint)
URI.resolve(String) is acceptableendpoint - the endpoint to return a URI for.public URI newAPIEndpointURI(URI endpoint)
URI.resolve(URI) is acceptableendpoint - the endpoint to return a URI for.public String versionPrefix()
public String getUsername()
public String getApiKey()
public boolean isSslEnabled()
public void setSslEnabled(boolean sslEnabled)
public String authAsHeader()
public io.higgs.http.client.HttpRequestBuilder http()
public String urlEncodingFormat()
public DataSiftConfig urlEncodingFormat(String format)
format - the formatpublic boolean isAutoReconnect()
public void setAutoReconnect(boolean autoReconnect)
autoReconnect - true or false, defaults to truepublic String[] sslProtocols()
public boolean compatibleSSLProtocolsFound()
public int connectTimeout()
public void connectTimeout(int connectTimeout)
public String getClientVersion()
Copyright © 2015. All Rights Reserved.