Class HTTPConnectionTools
java.lang.Object
org.biojava.nbio.structure.align.util.HTTPConnectionTools
a class that takes care about opening HttpURLConnections and sets the proper timeouts
- Since:
 - 9:58:25 AM
 - Version:
 - %I% %G%
 - Author:
 - Andreas Prlic
 
- 
Field Summary
Fields - 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionstatic InputStreamdo a POST to a URL and return the response stream for further processing elsewhere.static InputStreamdo a POST to a URL and return the response stream for further processing elsewhere.static InputStreamgetInputStream(URL url) connect to DAS server and return result as an InputStream.static InputStreamgetInputStream(URL url, boolean acceptGzipEncoding, int timeout) open a URL and return an InputStream to it if acceptGzipEncoding == true, use GZIPEncoding to compress communicationstatic InputStreamgetInputStream(URL url, int timeout) connect to DAS server and return result as an InputStream.static HttpURLConnectionopenHttpURLConnection(URL url) open HttpURLConnection.static HttpURLConnectionopenHttpURLConnection(URL url, int timeout) open HttpURLConnection. 
- 
Field Details
- 
USERAGENT
- See Also:
 
 - 
DEFAULT_CONNECTION_TIMEOUT
public static final int DEFAULT_CONNECTION_TIMEOUT- See Also:
 
 
 - 
 - 
Constructor Details
- 
HTTPConnectionTools
public HTTPConnectionTools() 
 - 
 - 
Method Details
- 
openHttpURLConnection
public static HttpURLConnection openHttpURLConnection(URL url, int timeout) throws IOException, ConnectException open HttpURLConnection. Recommended way to open HttpURLConnections, since this take care of setting timeouts properly for java 1.4 and 1.5- Parameters:
 url- URL to oopentimeout- timeout in milli seconds- Returns:
 - a HttpURLConnection
 - Throws:
 IOExceptionConnectException
 - 
openHttpURLConnection
open HttpURLConnection. Recommended way to open HttpURLConnections, since this take care of setting timeouts properly for java 1.4 and 1.5 uses the DEFAULT_CONNECTION_TIMEOUT (= 15 seconds)- Parameters:
 url- a URL to open a http connection to- Returns:
 - HttpURLConnect the opened connection
 - Throws:
 IOExceptionConnectException
 - 
getInputStream
connect to DAS server and return result as an InputStream. always asks for response to be in GZIP encoded- Parameters:
 url- the URL to connect totimeout- the timeout for the connection- Returns:
 - an InputStream
 - Throws:
 IOExceptionDASException- if DAS server returns error response code
 - 
getInputStream
connect to DAS server and return result as an InputStream. always asks for response to be in GZIP encoded- Parameters:
 url- the URL to connect to- Returns:
 - an InputStream
 - Throws:
 IOExceptionDASException- if DAS server returns error response code
 - 
getInputStream
public static InputStream getInputStream(URL url, boolean acceptGzipEncoding, int timeout) throws IOException open a URL and return an InputStream to it if acceptGzipEncoding == true, use GZIPEncoding to compress communication- Parameters:
 url-acceptGzipEncoding-- Returns:
 - an InputStream to the URL
 - Throws:
 IOExceptionDASException- if DAS server returns error response code
 - 
doPOST
do a POST to a URL and return the response stream for further processing elsewhere.- Parameters:
 url-- Returns:
 - InputStream of response
 - Throws:
 IOException
 - 
doPOST
do a POST to a URL and return the response stream for further processing elsewhere.- Parameters:
 url-- Returns:
 - InputStream of response
 - Throws:
 IOException
 
 -