public class HTTPConnectionTools extends Object
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_CONNECTION_TIMEOUT |
static String |
USERAGENT |
Constructor and Description |
---|
HTTPConnectionTools() |
Modifier and Type | Method and Description |
---|---|
static InputStream |
doPOST(URL url,
String data)
do a POST to a URL and return the response stream for further processing elsewhere.
|
static InputStream |
doPOST(URL url,
String data,
int timeout)
do a POST to a URL and return the response stream for further processing elsewhere.
|
static InputStream |
getInputStream(URL url)
connect to DAS server and return result as an InputStream.
|
static InputStream |
getInputStream(URL url,
boolean acceptGzipEncoding,
int timeout)
open a URL and return an InputStream to it
if acceptGzipEncoding == true, use GZIPEncoding to
compress communication
|
static InputStream |
getInputStream(URL url,
int timeout)
connect to DAS server and return result as an InputStream.
|
static HttpURLConnection |
openHttpURLConnection(URL url)
open HttpURLConnection.
|
static HttpURLConnection |
openHttpURLConnection(URL url,
int timeout)
open HttpURLConnection.
|
public static final String USERAGENT
public static final int DEFAULT_CONNECTION_TIMEOUT
public static HttpURLConnection openHttpURLConnection(URL url, int timeout) throws IOException, ConnectException
url
- URL to oopentimeout
- timeout in milli secondsIOException
ConnectException
public static HttpURLConnection openHttpURLConnection(URL url) throws IOException, ConnectException
url
- a URL to open a http connection toIOException
ConnectException
public static InputStream getInputStream(URL url, int timeout) throws IOException
url
- the URL to connect totimeout
- the timeout for the connectionIOException
DASException
- if DAS server returns error response codepublic static InputStream getInputStream(URL url) throws IOException
url
- the URL to connect toIOException
DASException
- if DAS server returns error response codepublic static InputStream getInputStream(URL url, boolean acceptGzipEncoding, int timeout) throws IOException
url
- acceptGzipEncoding
- IOException
DASException
- if DAS server returns error response codepublic static InputStream doPOST(URL url, String data) throws IOException
url
- IOException
public static InputStream doPOST(URL url, String data, int timeout) throws IOException
url
- IOException
Copyright © 2000–2016 BioJava. All rights reserved.