T
- associated typepublic class ConnectionOption<T>
extends java.lang.Object
Connector.open
methods of the Connector
.
The use ConnectionOptions is illustrated in the following example:
String url= ... ;
ConnectionOption <String> keep = new ConnectionOption<String>("KeepAlive", "KEEP_ALIVE");
ConnectionOption <byte[]> cred = new ConnectionOption<byte[]>("Credentials", new byte[]{(byte) 204, 29, (byte) 207, (byte) 217 });
ConnectionOption <Integer> proxy = new ConnectionOption<Integer>("Proxy", "east-proxy:80");
ConnectionOption <Integer> socketTimeout = new ConnectionOption<Integer>("Timeout", 2000);
try {
Connection c = Connector.open(url, cred, keep, proxy, socketTimeout);
} catch (IOException e) {
e.printStackTrace();
}
See also HttpConnection
for a full example.
Constructor and Description |
---|
ConnectionOption(java.lang.String name,
T value)
Create a new instance of ConnectionOption with
name and value . |
public ConnectionOption(java.lang.String name, T value)
name
and value
.
ConnectionOption names are case sensitive.name
- the name of the new ConnectionOptionvalue
- the value of the connection settingjava.lang.NullPointerException
- if the name
is nullpublic java.lang.String getName()
public T getValue()
Copyright (c) 2014, Oracle and/or its affiliates. All Rights Reserved. Use of this specification is subject to license terms.