merged 1.1 branch into head
[mir.git] / source / mir / util / HTTPClientHelper.java
index 666f4cf..68b21e6 100755 (executable)
 package mir.util;
 
 
-import java.io.InputStream;
 import java.io.IOException;
+import java.io.InputStream;
 
 import org.apache.commons.httpclient.HttpClient;
-import org.apache.commons.httpclient.HttpException;
 import org.apache.commons.httpclient.HttpMethod;
 import org.apache.commons.httpclient.methods.GetMethod;
 
-import mir.util.UtilExc;
-
 public class HTTPClientHelper {
   private HttpClient client;
   private HttpMethod method;
-  
+
   public HTTPClientHelper() {
-      client = new HttpClient();
-      client.setConnectionTimeout(5000);
-      client.setTimeout(5000);
+    client = new HttpClient();
+    client.setConnectionTimeout(5000);
+    client.setTimeout(5000);
   }
 
-
-  public InputStream getUrl(String anUrl) throws UtilExc{
-    try{
+  public InputStream getUrl(String anUrl) throws UtilExc {
+    try {
       method = new GetMethod(anUrl);
       method.setFollowRedirects(true);
       method.setStrictMode(false);
       client.executeMethod(method);
-      InputStream inputStream  = method.getResponseBodyAsStream();
+      InputStream inputStream = method.getResponseBodyAsStream();
       return inputStream;
     }
-    catch (IOException e){
-       throw new UtilExc(e.getMessage());
+    catch (IOException e) {
+      throw new UtilExc(e.getMessage());
     }
   }
-  
+
   public void releaseHTTPConnection() {
     method.releaseConnection();
     method.recycle();