/webportal/src/main/java/au/org/emii/portal/net/HttpConnection.java
Java | 60 lines | 10 code | 14 blank | 36 comment | 0 complexity | 9b6645b0f1144f43eeda42ff417fe4ba MD5 | raw file
1/* 2 * To change this template, choose Tools | Templates 3 * and open the template in the editor. 4 */ 5 6package au.org.emii.portal.net; 7 8import java.io.IOException; 9import java.net.URLConnection; 10 11/** 12 * 13 * @author geoff 14 */ 15public interface HttpConnection { 16 17 /** 18 * Return a URL connection that times out according to the 19 * net_connect_slow_timeout and net_read_slow_timeout entries 20 * in the config file 21 * @param uri to connect to 22 * @return 23 * @throws IOException 24 */ 25 URLConnection configureSlowURLConnection(String uri) throws IOException; 26 27 /** 28 * Return a URL connection that times out according to the 29 * net_connect_timeout and net_read_timeout entries in the 30 * config file 31 * @param uri 32 * @throws IOException 33 */ 34 URLConnection configureURLConnection(String uri) throws IOException; 35 36 /** 37 * Return a URL connection that times out after the passed in timeouts 38 * @param uri uri to connect to 39 * @param connectTimeout time to wait for a connection (ms) 40 * @param readtimeout time to wait for the uri to be fully read (ms) 41 * @return 42 * @throws IOException 43 */ 44 URLConnection configureURLConnection(String uri, int connectTimeout, int readtimeout) throws IOException; 45 46 47 48 49 50 URLConnection configureURLConnectionWithAuthentication(String uri, String userName, String passWord) throws IOException; 51 52 53 /** 54 * Readback the raw data from a uri and return it 55 * @param uri 56 * @return 57 */ 58 String readRawData(String uri); 59 60}