/webportal/src/main/java/au/org/emii/portal/net/HttpConnection.java

http://alageospatialportal.googlecode.com/ · 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. package au.org.emii.portal.net;
  6. import java.io.IOException;
  7. import java.net.URLConnection;
  8. /**
  9. *
  10. * @author geoff
  11. */
  12. public interface HttpConnection {
  13. /**
  14. * Return a URL connection that times out according to the
  15. * net_connect_slow_timeout and net_read_slow_timeout entries
  16. * in the config file
  17. * @param uri to connect to
  18. * @return
  19. * @throws IOException
  20. */
  21. URLConnection configureSlowURLConnection(String uri) throws IOException;
  22. /**
  23. * Return a URL connection that times out according to the
  24. * net_connect_timeout and net_read_timeout entries in the
  25. * config file
  26. * @param uri
  27. * @throws IOException
  28. */
  29. URLConnection configureURLConnection(String uri) throws IOException;
  30. /**
  31. * Return a URL connection that times out after the passed in timeouts
  32. * @param uri uri to connect to
  33. * @param connectTimeout time to wait for a connection (ms)
  34. * @param readtimeout time to wait for the uri to be fully read (ms)
  35. * @return
  36. * @throws IOException
  37. */
  38. URLConnection configureURLConnection(String uri, int connectTimeout, int readtimeout) throws IOException;
  39. URLConnection configureURLConnectionWithAuthentication(String uri, String userName, String passWord) throws IOException;
  40. /**
  41. * Readback the raw data from a uri and return it
  42. * @param uri
  43. * @return
  44. */
  45. String readRawData(String uri);
  46. }