public class Connection extends Object
Modifier and Type | Field and Description |
---|---|
static String |
CONNECT_TIMEOUT_PARAM |
protected int |
connectTimeoutMilli |
static int |
DEFAULT_CONNECT_TIMEOUT_MILLI |
static int |
DEFAULT_READ_TIMEOUT_MILLI |
static int |
DEFAULT_SO_TIMEOUT_MILLI |
static int |
DEFAULT_WRITE_TIMEOUT_MILLI |
static char |
firstOptDelimiter |
static char |
pathDelimiter |
static char |
portDelimiter |
static String |
protDelimiter |
static String |
protHttp |
static String |
protHttps |
static String |
READ_TIMEOUT_PARAM |
protected int |
readTimeoutMilli |
static String |
SOCKET_TIMEOUT_PARAM |
protected int |
socketTimeoutMilli |
static char |
subsequentOptDelimiter |
static String |
WRITE_TIMEOUT_PARAM |
protected int |
writeTimeoutMilli |
Constructor and Description |
---|
Connection(boolean ssl,
String host,
int port)
Instantiates a new connection.
|
Connection(String connectionstring)
Instantiates a new connection.
|
Connection(String protocol,
String host,
String port)
Instantiates a new connection.
|
Connection(String protocol,
String host,
String port,
String path)
Instantiates a new connection.
|
Connection(String protocol_,
String host_,
String port_,
String path_,
String[] options_)
Instantiates a new connection.
|
Modifier and Type | Method and Description |
---|---|
static String |
buildUrl(String protocol,
String host,
String port)
Builds the url.
|
static String |
buildUrl(String protocol,
String host,
String port,
String path)
Builds the url.
|
static String |
buildUrl(String protocol,
String host,
String port,
String path,
String[] options)
Builds the url.
|
URLConnection |
createConnection()
Creates the connection.
|
static URLConnection |
createConnection(URL url)
Creates a new
java.net.URLConnection object from the
specified java.net.URL . |
boolean |
equals(Object aThat) |
boolean |
getAllowInvalidCerts()
Gets the allow invalid certs.
|
String |
getBaseUrl()
Gets the base url.
|
String |
getBasicAuthString()
Gets the basic auth string.
|
int |
getConnectTimeoutMilli()
Gets the connect timeout milli.
|
org.hpccsystems.ws.client.utils.Connection.Credentials |
getCredentials()
Gets the credentials.
|
String |
getHost()
Gets the host.
|
Boolean |
getIsHttps()
Gets the checks if is https.
|
String |
getPassword()
Gets the password.
|
String |
getPort()
Gets the port.
|
int |
getPortInt()
Gets the port int.
|
String |
getProtocol()
Gets the protocol.
|
static String |
getProtocol(boolean ssl)
Gets the protocol.
|
int |
getReadTimeoutMilli()
Gets the read timeout milli.
|
int |
getSocketTimeoutMilli()
Gets the socket timeout milli.
|
String |
getUrl()
Gets the url.
|
String |
getUserName()
Gets the user name.
|
int |
getWriteTimeoutMilli()
Gets the write timeout milli.
|
boolean |
hasCredentials()
Checks for credentials.
|
int |
hashCode() |
static boolean |
isSslProtocol(String protocol)
Checks if is ssl protocol.
|
void |
setAllowInvalidCerts(boolean allowInvalidCerts)
Sets the allow invalid certs.
|
void |
setConnectTimeoutMilli(int connectTimeoutMilli)
Sets the connect timeout milli.
|
void |
setCredentials(String username,
String password)
Sets the credentials.
|
void |
setEncodedCredentials(String encodedcreds)
Sets the encoded credentials.
|
void |
setPassword(String password)
Sets the password.
|
void |
setReadTimeoutMilli(int readTimeoutMilli)
Sets the read timeout milli.
|
void |
setSocketTimeoutMilli(int socketTimeoutMilli)
Sets the socket timeout milli.
|
void |
setUserName(String userName)
Sets the user name.
|
void |
setWriteTimeoutMilli(int writeTimeoutMilli)
Sets the write timeout milli.
|
String |
toString() |
public static final String protDelimiter
public static final char portDelimiter
public static final char pathDelimiter
public static final char firstOptDelimiter
public static final char subsequentOptDelimiter
public static final String protHttp
public static final String protHttps
public static final String CONNECT_TIMEOUT_PARAM
public static final String READ_TIMEOUT_PARAM
public static final String WRITE_TIMEOUT_PARAM
public static final String SOCKET_TIMEOUT_PARAM
public static final int DEFAULT_CONNECT_TIMEOUT_MILLI
public static final int DEFAULT_SO_TIMEOUT_MILLI
public static final int DEFAULT_WRITE_TIMEOUT_MILLI
public static final int DEFAULT_READ_TIMEOUT_MILLI
protected int connectTimeoutMilli
protected int readTimeoutMilli
protected int writeTimeoutMilli
protected int socketTimeoutMilli
public Connection(String connectionstring) throws MalformedURLException
connectionstring
- as defined by java.net.URLMalformedURLException
- the malformed URL exceptionpublic Connection(boolean ssl, String host, int port)
ssl
- the sslhost
- the hostport
- the portpublic Connection(String protocol, String host, String port)
protocol
- the protocolhost
- the hostport
- the portpublic Connection(String protocol, String host, String port, String path)
protocol
- the protocolhost
- the hostport
- the portpath
- the pathpublic static String getProtocol(boolean ssl)
ssl
- the sslpublic static boolean isSslProtocol(String protocol)
protocol
- the protocolpublic String getUrl()
public String getBaseUrl()
public boolean hasCredentials()
public void setEncodedCredentials(String encodedcreds) throws Exception
encodedcreds
- the new encoded credentialsException
- the exceptionpublic String getBasicAuthString()
public String getHost()
public String getPort()
public int getPortInt()
public String getUserName()
public void setUserName(String userName)
userName
- the new user namepublic String getPassword()
public void setPassword(String password)
password
- the new passwordpublic String getProtocol()
public Boolean getIsHttps()
public boolean getAllowInvalidCerts()
public void setAllowInvalidCerts(boolean allowInvalidCerts)
allowInvalidCerts
- the new allow invalid certspublic void setCredentials(String username, String password)
username
- the usernamepassword
- the passwordpublic org.hpccsystems.ws.client.utils.Connection.Credentials getCredentials()
public URLConnection createConnection() throws IOException
IOException
- Signals that an I/O exception has occurred.public static URLConnection createConnection(URL url) throws IOException
java.net.URLConnection
object from the
specified java.net.URL
. This is a convenience method which
will set the doInput
, doOutput
,
useCaches
and defaultUseCaches
fields to the
appropriate settings in the correct order.url
- the urlIOException
- Signals that an I/O exception has occurred.public static String buildUrl(String protocol, String host, String port)
protocol
- the protocolhost
- the hostport
- the portpublic static String buildUrl(String protocol, String host, String port, String path)
protocol
- the protocolhost
- the hostport
- the portpath
- the pathpublic static String buildUrl(String protocol, String host, String port, String path, String[] options)
protocol
- the protocolhost
- the hostport
- the portpath
- the pathoptions
- the optionspublic int getConnectTimeoutMilli()
public void setConnectTimeoutMilli(int connectTimeoutMilli)
connectTimeoutMilli
- the connectTimeoutMilli to setpublic int getReadTimeoutMilli()
public void setReadTimeoutMilli(int readTimeoutMilli)
readTimeoutMilli
- the readTimeoutMilli to setpublic int getWriteTimeoutMilli()
public void setWriteTimeoutMilli(int writeTimeoutMilli)
writeTimeoutMilli
- the writeTimeoutMilli to setpublic int getSocketTimeoutMilli()
public void setSocketTimeoutMilli(int socketTimeoutMilli)
socketTimeoutMilli
- the socketTimeoutMilli to setCopyright © 2021. All rights reserved.