public class HTTPConnectionTools
extends java.lang.Object
Modifier and Type | Field | Description |
---|---|---|
static int |
DEFAULT_CONNECTION_TIMEOUT |
|
static java.lang.String |
USERAGENT |
Constructor | Description |
---|---|
HTTPConnectionTools() |
Modifier and Type | Method | Description |
---|---|---|
static java.io.InputStream |
doPOST(java.net.URL url,
java.lang.String data) |
do a POST to a URL and return the response stream for further processing elsewhere.
|
static java.io.InputStream |
doPOST(java.net.URL url,
java.lang.String data,
int timeout) |
do a POST to a URL and return the response stream for further processing elsewhere.
|
static java.io.InputStream |
getInputStream(java.net.URL url) |
connect to DAS server and return result as an InputStream.
|
static java.io.InputStream |
getInputStream(java.net.URL url,
boolean acceptGzipEncoding,
int timeout) |
open a URL and return an InputStream to it
if acceptGzipEncoding == true, use GZIPEncoding to
compress communication
|
static java.io.InputStream |
getInputStream(java.net.URL url,
int timeout) |
connect to DAS server and return result as an InputStream.
|
static java.net.HttpURLConnection |
openHttpURLConnection(java.net.URL url) |
open HttpURLConnection.
|
static java.net.HttpURLConnection |
openHttpURLConnection(java.net.URL url,
int timeout) |
open HttpURLConnection.
|
public static final java.lang.String USERAGENT
public static final int DEFAULT_CONNECTION_TIMEOUT
public static java.net.HttpURLConnection openHttpURLConnection(java.net.URL url, int timeout) throws java.io.IOException, java.net.ConnectException
url
- URL to oopentimeout
- timeout in milli secondsjava.io.IOException
java.net.ConnectException
public static java.net.HttpURLConnection openHttpURLConnection(java.net.URL url) throws java.io.IOException, java.net.ConnectException
url
- a URL to open a http connection tojava.io.IOException
java.net.ConnectException
public static java.io.InputStream getInputStream(java.net.URL url, int timeout) throws java.io.IOException
url
- the URL to connect totimeout
- the timeout for the connectionjava.io.IOException
DASException
- if DAS server returns error response codepublic static java.io.InputStream getInputStream(java.net.URL url) throws java.io.IOException
url
- the URL to connect tojava.io.IOException
DASException
- if DAS server returns error response codepublic static java.io.InputStream getInputStream(java.net.URL url, boolean acceptGzipEncoding, int timeout) throws java.io.IOException
url
- acceptGzipEncoding
- java.io.IOException
DASException
- if DAS server returns error response codepublic static java.io.InputStream doPOST(java.net.URL url, java.lang.String data) throws java.io.IOException
url
- java.io.IOException
public static java.io.InputStream doPOST(java.net.URL url, java.lang.String data, int timeout) throws java.io.IOException
url
- java.io.IOException