| java.lang.Object | |
| ↳ | com.pnfsoftware.jeb.util.Net |
Network routines class. Proxy supported; http/https redirects supported.
| Public Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|
Net()
Create a default object for a direct Internet connections.
| |||||||||||
|
Net(Proxy proxy)
Create a default object with optional proxy settings: The user-agent is set to
"PNF Software UP"; the timeouts are set to 60 seconds for connect, 30 seconds for read;
redirects are followed.
| |||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| static String |
buildProxyString(Proxy p)
Create a string representing the internal state of a network proxy object.
| ||||||||||
| synchronized byte[] |
downloadBinary(String address)
Issue a GET request and receive the answer.
| ||||||||||
| synchronized int | getConnectTimeout() | ||||||||||
| synchronized Proxy | getProxy() | ||||||||||
| synchronized int | getReadTimeout() | ||||||||||
| synchronized String | getUserAgent() | ||||||||||
| synchronized String |
httpPost(String address, String data)
Same as
httpPost(address, data, null). | ||||||||||
| synchronized String |
httpPost(String address, String data, long[] serverTimestampArray)
Convenience routine to send POST data to the JPS or the floating license controller.
| ||||||||||
| static Proxy |
parseProxyString(String s)
Parse a string representing basic proxy settings.
| ||||||||||
| synchronized void | setConnectTimeout(int timeout) | ||||||||||
| synchronized void | setFollowAllRedirects(boolean follow_all_redirects) | ||||||||||
| synchronized void | setProxy(Proxy proxy) | ||||||||||
| synchronized void | setReadTimeout(int timeout) | ||||||||||
| synchronized void | setUserAgent(String userAgent) | ||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
Create a default object with optional proxy settings: The user-agent is set to "PNF Software UP"; the timeouts are set to 60 seconds for connect, 30 seconds for read; redirects are followed.
| proxy | optional proxy configuration |
|---|
Create a string representing the internal state of a network proxy object. To be used in
conjunction with parseProxyString(String).
Issue a GET request and receive the answer. If the content is gzip-ed, it will be returned as decoded.
| address | the HTTP or HTTPS URL |
|---|
Same as httpPost(address, data, null).
Convenience routine to send POST data to the JPS or the floating license controller.
Do not use this method to http-post just anything. The data string to be posted will be:
The server's response, if any, must be a sequence of strings. The strings will be concatenated with newline characters and returned as a single string object.
| address | string to be posted |
|---|---|
| data | HTTP URL (HTTPS not supported as of now) |
| serverTimestampArray | optional, filled with the server timestamp provided in the HTTP response (epoch in ms) |
Parse a string representing basic proxy settings. The format is:
type|hostname|port where type can be either "http" or "socks".
| s | the non-null string |
|---|