You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@manifoldcf.apache.org by kw...@apache.org on 2012/11/19 02:56:37 UTC

svn commit: r1411045 [2/2] - in /manifoldcf/trunk: ./ connectors/rss/ connectors/rss/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/rss/ connectors/rss/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/rss/ conn...

Modified: manifoldcf/trunk/connectors/wiki/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/wiki/WikiConnector.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/wiki/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/wiki/WikiConnector.java?rev=1411045&r1=1411044&r2=1411045&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/wiki/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/wiki/WikiConnector.java (original)
+++ manifoldcf/trunk/connectors/wiki/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/wiki/WikiConnector.java Mon Nov 19 01:56:35 2012
@@ -31,16 +31,36 @@ import org.apache.manifoldcf.agents.comm
 import org.apache.manifoldcf.agents.common.XMLStringContext;
 import org.apache.manifoldcf.agents.common.XMLFileContext;
 
-import org.apache.commons.httpclient.*;
-import org.apache.commons.httpclient.methods.*;
-import org.apache.commons.httpclient.params.*;
-import org.apache.commons.httpclient.auth.*;
-import org.apache.commons.httpclient.protocol.*;
+import org.apache.http.conn.ClientConnectionManager;
+import org.apache.http.client.HttpClient;
+import org.apache.http.impl.conn.PoolingClientConnectionManager;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.http.client.methods.HttpRequestBase;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.HttpResponse;
+import org.apache.http.params.BasicHttpParams;
+import org.apache.http.params.HttpParams;
+import org.apache.http.params.CoreConnectionPNames;
+import org.apache.http.HttpEntity;
+import org.apache.http.client.entity.UrlEncodedFormEntity;
+import org.apache.http.NameValuePair;
+import org.apache.http.message.BasicNameValuePair;
+import org.apache.http.protocol.HTTP;
+import org.apache.http.util.EntityUtils;
+import org.apache.http.message.BasicHeader;
+
+import org.apache.http.conn.ConnectTimeoutException;
+import org.apache.http.client.CircularRedirectException;
+import org.apache.http.NoHttpResponseException;
+import org.apache.http.HttpException;
 
 import java.util.*;
 import java.io.*;
 import java.net.*;
 
+import java.util.concurrent.TimeUnit;
+
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
@@ -72,12 +92,15 @@ public class WikiConnector extends org.a
   /** Base URL */
   protected String baseURL = null;
   
+  /** The user-agent for this connector instance */
+  protected String userAgent = null;
+
   protected String serverLogin = null;
   protected String serverPass = null;
   protected String serverDomain = null;
   
   /** Connection management */
-  protected MultiThreadedHttpConnectionManager connectionManager = null;
+  protected ClientConnectionManager connectionManager = null;
 
   protected HttpClient httpClient = null;
   
@@ -123,6 +146,12 @@ public class WikiConnector extends org.a
   {
     if (hasBeenSetup == false)
     {
+      String emailAddress = params.getParameter(WikiConfig.PARAM_EMAIL);
+      if (emailAddress != null)
+        userAgent = "Mozilla/5.0 (ApacheManifoldCFWikiReader; "+((emailAddress==null)?"":emailAddress)+")";
+      else
+        userAgent = null;
+
       String protocol = params.getParameter(WikiConfig.PARAM_PROTOCOL);
       if (protocol == null || protocol.length() == 0)
         protocol = "http";
@@ -136,11 +165,18 @@ public class WikiConnector extends org.a
       baseURL = protocol + "://" + server + ((portString!=null)?":" + portString:"") + path + "/api.php?format=xml&";
 
       // Set up connection manager
-      connectionManager = new MultiThreadedHttpConnectionManager();
-      connectionManager.getParams().setMaxTotalConnections(1);
-
-      httpClient = new HttpClient(connectionManager);
-
+      PoolingClientConnectionManager localConnectionManager = new PoolingClientConnectionManager();
+      localConnectionManager.setMaxTotal(1);
+      connectionManager = localConnectionManager;
+
+      BasicHttpParams params = new BasicHttpParams();
+      params.setBooleanParameter(CoreConnectionPNames.TCP_NODELAY,true);
+      params.setBooleanParameter(CoreConnectionPNames.STALE_CONNECTION_CHECK,false);
+      params.setIntParameter(CoreConnectionPNames.SO_TIMEOUT,300000);
+      params.setIntParameter(CoreConnectionPNames.CONNECTION_TIMEOUT,300000);
+      DefaultHttpClient localHttpClient = new DefaultHttpClient(connectionManager,params);
+      httpClient = localHttpClient;
+      
       loginToAPI();
       
       hasBeenSetup = true;
@@ -158,7 +194,7 @@ public class WikiConnector extends org.a
       return false;
 
     // Grab the httpclient, and use the same one throughout.
-    HttpClient client = getInitializedClient();
+    HttpClient client = httpClient;
     
     // First step in login process: get the token
     Map<String, String> loginParams = new HashMap<String, String>();
@@ -175,31 +211,14 @@ public class WikiConnector extends org.a
 
     APILoginResult result = new APILoginResult();
         
-    HttpMethodBase method = getInitializedPostMethod(loginURL,loginParams);
-
     try {
+      HttpRequestBase method = getInitializedPostMethod(loginURL,loginParams);
       ExecuteAPILoginThread t = new ExecuteAPILoginThread(client, method, result);
       try {
         t.start();
         t.join();
 
-        Throwable thr = t.getException();
-        if (thr != null) {
-          if (thr instanceof ManifoldCFException) {
-            if (((ManifoldCFException) thr).getErrorCode() == ManifoldCFException.INTERRUPTED) {
-              throw new InterruptedException(thr.getMessage());
-            }
-            throw (ManifoldCFException) thr;
-          } else if (thr instanceof ServiceInterruption) {
-            throw (ServiceInterruption) thr;
-          } else if (thr instanceof IOException) {
-            throw (IOException) thr;
-          } else if (thr instanceof RuntimeException) {
-            throw (RuntimeException) thr;
-          } else {
-            throw (Error) thr;
-          }
-        }
+        handleException(t.getException());
       } catch (ManifoldCFException e) {
         t.interrupt();
         throw e;
@@ -209,6 +228,9 @@ public class WikiConnector extends org.a
       } catch (IOException e) {
         t.interrupt();
         throw e;
+      } catch (HttpException e) {
+	t.interrupt();
+	throw e;
       } catch (InterruptedException e) {
         t.interrupt();
         // We need the caller to abandon any connections left around, so rethrow in a way that forces them to process the event properly.
@@ -228,14 +250,8 @@ public class WikiConnector extends org.a
       }
       
     } catch (InterruptedException e) {
-      // Drop the connection on the floor
-      method = null;
       throw new ManifoldCFException("Interrupted: " + e.getMessage(), e, ManifoldCFException.INTERRUPTED);
     } catch (ManifoldCFException e) {
-      if (e.getErrorCode() == ManifoldCFException.INTERRUPTED) // Drop the connection on the floor
-      {
-        method = null;
-      }
       throw e;
     } catch (java.net.SocketTimeoutException e) {
       long currentTime = System.currentTimeMillis();
@@ -243,48 +259,30 @@ public class WikiConnector extends org.a
     } catch (java.net.SocketException e) {
       long currentTime = System.currentTimeMillis();
       throw new ServiceInterruption("Login received a socket error reading from Wiki server: " + e.getMessage(), e, currentTime + 300000L, currentTime + 12L * 60000L, -1, false);
-    } catch (org.apache.commons.httpclient.ConnectTimeoutException e) {
+    } catch (ConnectTimeoutException e) {
       long currentTime = System.currentTimeMillis();
       throw new ServiceInterruption("Login connection timed out reading from Wiki server: " + e.getMessage(), e, currentTime + 300000L, currentTime + 12L * 60000L, -1, false);
     } catch (InterruptedIOException e) {
-      method = null;
       throw new ManifoldCFException("Interrupted: " + e.getMessage(), e, ManifoldCFException.INTERRUPTED);
     } catch (IOException e) {
       throw new ManifoldCFException("Login had an IO failure: " + e.getMessage(), e);
-    } finally {
-      if (method != null) {
-        method.releaseConnection();
-      }
+    } catch (HttpException e) {
+      throw new ManifoldCFException("Login had an Http exception: "+e.getMessage(), e);
     }
 
     // First request is finished.  Fire off the second one.
     
     loginParams.put("lgtoken", token);
     
-    method = getInitializedPostMethod(loginURL,loginParams);
     try {
-      ExecuteTokenAPILoginThread t = new ExecuteTokenAPILoginThread(client, method, result);
+      HttpRequestBase method = getInitializedPostMethod(loginURL,loginParams);
+      ExecuteTokenAPILoginThread t = new ExecuteTokenAPILoginThread(httpClient, method, result);
       try {
         t.start();
         t.join();
 
-        Throwable thr = t.getException();
-        if (thr != null) {
-          if (thr instanceof ManifoldCFException) {
-            if (((ManifoldCFException) thr).getErrorCode() == ManifoldCFException.INTERRUPTED) {
-              throw new InterruptedException(thr.getMessage());
-            }
-            throw (ManifoldCFException) thr;
-          } else if (thr instanceof ServiceInterruption) {
-            throw (ServiceInterruption) thr;
-          } else if (thr instanceof IOException) {
-            throw (IOException) thr;
-          } else if (thr instanceof RuntimeException) {
-            throw (RuntimeException) thr;
-          } else {
-            throw (Error) thr;
-          }
-        }
+	handleException(t.getException());
+	
       } catch (ManifoldCFException e) {
         t.interrupt();
         throw e;
@@ -294,6 +292,9 @@ public class WikiConnector extends org.a
       } catch (IOException e) {
         t.interrupt();
         throw e;
+      } catch (HttpException e) {
+	t.interrupt();
+	throw e;
       } catch (InterruptedException e) {
         t.interrupt();
         // We need the caller to abandon any connections left around, so rethrow in a way that forces them to process the event properly.
@@ -302,14 +303,8 @@ public class WikiConnector extends org.a
 
       // Fall through
     } catch (InterruptedException e) {
-      // Drop the connection on the floor
-      method = null;
       throw new ManifoldCFException("Interrupted: " + e.getMessage(), e, ManifoldCFException.INTERRUPTED);
     } catch (ManifoldCFException e) {
-      if (e.getErrorCode() == ManifoldCFException.INTERRUPTED) // Drop the connection on the floor
-      {
-        method = null;
-      }
       throw e;
     } catch (java.net.SocketTimeoutException e) {
       long currentTime = System.currentTimeMillis();
@@ -317,18 +312,15 @@ public class WikiConnector extends org.a
     } catch (java.net.SocketException e) {
       long currentTime = System.currentTimeMillis();
       throw new ServiceInterruption("Login received a socket error reading from Wiki server: " + e.getMessage(), e, currentTime + 300000L, currentTime + 12L * 60000L, -1, false);
-    } catch (org.apache.commons.httpclient.ConnectTimeoutException e) {
+    } catch (ConnectTimeoutException e) {
       long currentTime = System.currentTimeMillis();
       throw new ServiceInterruption("Login connection timed out reading from Wiki server: " + e.getMessage(), e, currentTime + 300000L, currentTime + 12L * 60000L, -1, false);
     } catch (InterruptedIOException e) {
-      method = null;
       throw new ManifoldCFException("Interrupted: " + e.getMessage(), e, ManifoldCFException.INTERRUPTED);
     } catch (IOException e) {
       throw new ManifoldCFException("Login had an IO failure: " + e.getMessage(), e);
-    } finally {
-      if (method != null) {
-        method.releaseConnection();
-      }
+    } catch (HttpException e) {
+      throw new ManifoldCFException("Login had an Http exception: "+e.getMessage(), e);
     }
     
     // Check result
@@ -347,12 +339,12 @@ public class WikiConnector extends org.a
   protected class ExecuteAPILoginThread extends Thread {
 
     protected HttpClient client;
-    protected HttpMethodBase executeMethod;
+    protected HttpRequestBase executeMethod;
     protected APILoginResult result;
     protected Throwable exception = null;
     protected String token = null;
 
-    public ExecuteAPILoginThread(HttpClient client, HttpMethodBase executeMethod, APILoginResult result) {
+    public ExecuteAPILoginThread(HttpClient client, HttpRequestBase executeMethod, APILoginResult result) {
       super();
       setDaemon(true);
       this.client = client;
@@ -363,13 +355,13 @@ public class WikiConnector extends org.a
     public void run() {
       try {
         // Call the execute method appropriately
-        int rval = client.executeMethod(executeMethod);
-        if (rval != 200) {
-          throw new ManifoldCFException("Unexpected response code " + rval + ": " + executeMethod.getResponseBodyAsString());
+	HttpResponse rval = client.execute(executeMethod);
+        if (rval.getStatusLine().getStatusCode() != 200) {
+          throw new ManifoldCFException("Unexpected response code " + rval.getStatusLine().getStatusCode() + ": " + readResponseAsString(rval));
         }
 
         // Read response and make sure it's valid
-        InputStream is = executeMethod.getResponseBodyAsStream();
+        InputStream is = rval.getEntity().getContent();
         try {
           // Parse the document.  This will cause various things to occur, within the instantiated XMLContext class.
           //<api>
@@ -388,6 +380,10 @@ public class WikiConnector extends org.a
               x.parse(is);
               token = c.getToken();
             }
+	    catch (InterruptedIOException e)
+	    {
+	      throw e;
+	    }
             catch (IOException e)
             {
               long time = System.currentTimeMillis();
@@ -405,6 +401,8 @@ public class WikiConnector extends org.a
         }
       } catch (Throwable e) {
         this.exception = e;
+      } finally {
+	executeMethod.abort();
       }
     }
 
@@ -494,11 +492,11 @@ public class WikiConnector extends org.a
   protected class ExecuteTokenAPILoginThread extends Thread {
 
     protected HttpClient client;
-    protected HttpMethodBase executeMethod;
+    protected HttpRequestBase executeMethod;
     protected Throwable exception = null;
     protected APILoginResult result;
 
-    public ExecuteTokenAPILoginThread(HttpClient client, HttpMethodBase executeMethod, APILoginResult result) {
+    public ExecuteTokenAPILoginThread(HttpClient client, HttpRequestBase executeMethod, APILoginResult result) {
       super();
       setDaemon(true);
       this.client = client;
@@ -509,13 +507,13 @@ public class WikiConnector extends org.a
     public void run() {
       try {
         // Call the execute method appropriately
-        int rval = client.executeMethod(executeMethod);
-        if (rval != 200) {
-          throw new ManifoldCFException("Unexpected response code " + rval + ": " + executeMethod.getResponseBodyAsString());
+        HttpResponse rval = client.execute(executeMethod);
+        if (rval.getStatusLine().getStatusCode() != 200) {
+          throw new ManifoldCFException("Unexpected response code " + rval.getStatusLine().getStatusCode() + ": " + readResponseAsString(rval));
         }
 
         // Read response and make sure it's valid
-        InputStream is = executeMethod.getResponseBodyAsStream();
+        InputStream is = rval.getEntity().getContent();
         try {
           // Parse the document.  This will cause various things to occur, within the instantiated XMLContext class.
           //<api>
@@ -550,6 +548,8 @@ public class WikiConnector extends org.a
         }
       } catch (Throwable e) {
         this.exception = e;
+      } finally {
+	executeMethod.abort();
       }
     }
 
@@ -640,7 +640,7 @@ public class WikiConnector extends org.a
     throws ManifoldCFException
   {
     if (connectionManager != null)
-      connectionManager.closeIdleConnections(60000L);
+      connectionManager.closeIdleConnections(60000L,TimeUnit.MILLISECONDS);
   }
 
   /** Close the connection.  Call this before discarding the connection.
@@ -655,7 +655,8 @@ public class WikiConnector extends org.a
     serverPass = null;
     serverDomain = null;
     baseURL = null;
-    
+    userAgent = null;
+
     if (httpClient != null) {
       httpClient = null;
     }
@@ -839,12 +840,19 @@ public class WikiConnector extends org.a
     throws ManifoldCFException, IOException
   {
     tabsArray.add(Messages.getString(locale,"WikiConnector.Server"));
+    tabsArray.add(Messages.getString(locale,"WikiConnector.Email"));
 
     out.print(
 "<script type=\"text/javascript\">\n"+
 "<!--\n"+
 "function checkConfig()\n"+
 "{\n"+
+"  if (editconnection.email.value != \"\" && editconnection.email.value.indexOf(\"@\") == -1)\n"+
+"  {\n"+
+"    alert(\""+Messages.getBodyJavascriptString(locale,"WikiConnector.NeedAValidEmailAddress")+"\");\n"+
+"    editconnection.email.focus();\n"+
+"    return false;\n"+
+"  }\n"+
 "  if (editconnection.serverport.value != \"\" && !isInteger(editconnection.serverport.value))\n"+
 "  {\n"+
 "    alert(\""+Messages.getBodyJavascriptString(locale,"WikiConnector.WikiServerPortMustBeAValidInteger")+"\");\n"+
@@ -862,6 +870,13 @@ public class WikiConnector extends org.a
 "\n"+
 "function checkConfigForSave()\n"+
 "{\n"+
+"  if (editconnection.email.value == \"\")\n"+
+"  {\n"+
+"    alert(\""+Messages.getBodyJavascriptString(locale,"WikiConnector.EmailAddressRequiredToBeIncludedInAllRequestHeaders")+"\");\n"+
+"    SelectTab(\""+Messages.getBodyJavascriptString(locale,"WikiConnector.Email")+"\");\n"+
+"    editconnection.email.focus();\n"+
+"    return false;\n"+
+"  }\n"+
 "  if (editconnection.servername.value == \"\")\n"+
 "  {\n"+
 "    alert(\""+Messages.getBodyJavascriptString(locale,"WikiConnector.PleaseSupplyAValidWikiServerName")+"\");\n"+
@@ -904,6 +919,10 @@ public class WikiConnector extends org.a
     Locale locale, ConfigParams parameters, String tabName)
     throws ManifoldCFException, IOException
   {
+    String email = parameters.getParameter(WikiConfig.PARAM_EMAIL);
+    if (email == null)
+      email = "";
+
     String protocol = parameters.getParameter(WikiConfig.PARAM_PROTOCOL);
     if (protocol == null)
       protocol = "http";
@@ -933,6 +952,25 @@ public class WikiConnector extends org.a
       domain = "";
     }
     
+    // Email tab
+    if (tabName.equals(Messages.getString(locale,"WikiConnector.Email")))
+    {
+      out.print(
+"<table class=\"displaytable\">\n"+
+"  <tr><td class=\"separator\" colspan=\"2\"><hr/></td></tr>\n"+
+"  <tr>\n"+
+"    <td class=\"description\"><nobr>" + Messages.getBodyString(locale,"WikiConnector.EmailAddressToContactColon") + "</nobr></td><td class=\"value\"><input type=\"text\" size=\"32\" name=\"email\" value=\""+org.apache.manifoldcf.ui.util.Encoder.attributeEscape(email)+"\"/></td>\n"+
+"  </tr>\n"+
+"</table>\n"
+      );
+    }
+    else
+    {
+      out.print(
+"<input type=\"hidden\" name=\"email\" value=\""+org.apache.manifoldcf.ui.util.Encoder.attributeEscape(email)+"\"/>\n"
+      );
+    }
+
     if (tabName.equals(Messages.getString(locale,"WikiConnector.Server")))
     {
       out.print(
@@ -1015,6 +1053,10 @@ public class WikiConnector extends org.a
     Locale locale, ConfigParams parameters)
     throws ManifoldCFException
   {
+    String email = variableContext.getParameter("email");
+    if (email != null)
+      parameters.setParameter(WikiConfig.PARAM_EMAIL,email);
+
     String protocol = variableContext.getParameter("serverprotocol");
     if (protocol != null)
       parameters.setParameter(WikiConfig.PARAM_PROTOCOL,protocol);
@@ -1620,29 +1662,32 @@ public class WikiConnector extends org.a
 
   // Protected static classes and methods
 
-  /** Create and initialize an HttpClient instance */
-  protected HttpClient getInitializedClient()
-    throws ServiceInterruption, ManifoldCFException
-  {
-    return httpClient;
-  }
-
-  /** Create and initialize an HttpMethodBase */
-  protected HttpMethodBase getInitializedMethod(String URL)
-  {
-    GetMethod method = new GetMethod(URL);
-    method.getParams().setParameter("http.socket.timeout", new Integer(300000));
+  /** Create and initialize an HttpRequestBase */
+  protected HttpRequestBase getInitializedGetMethod(String URL)
+    throws IOException
+  {
+    HttpGet method = new HttpGet(URL);
+    if (userAgent != null)
+      method.setHeader(new BasicHeader("User-Agent",userAgent));
     return method;
   }
 
   /** Create an initialize a post method */
-  protected HttpMethodBase getInitializedPostMethod(String URL, Map<String,String> params)
+  protected HttpRequestBase getInitializedPostMethod(String URL, Map<String,String> params)
+    throws IOException
   {
-    PostMethod method = new PostMethod(URL);
+    HttpPost method = new HttpPost(URL);
+    if (userAgent != null)
+      method.setHeader(new BasicHeader("User-Agent",userAgent));
+
+    List<NameValuePair> pairs = new ArrayList<NameValuePair>();
+    
     for (String key : params.keySet()) {
-      method.setParameter(key, params.get(key));
+      pairs.add(new BasicNameValuePair(key, params.get(key)));
     }
-    method.getParams().setParameter("http.socket.timeout", new Integer(300000));
+    
+    method.setEntity(new UrlEncodedFormEntity(pairs, HTTP.UTF_8));
+    
     return method;
   }
   
@@ -1657,33 +1702,16 @@ public class WikiConnector extends org.a
     boolean loginAttempted = false;
     while (true)
     {
-      HttpClient client = getInitializedClient();
-      HttpMethodBase executeMethod = getInitializedMethod(getCheckURL());
+      HttpClient client = httpClient;
       try
       {
+	HttpRequestBase executeMethod = getInitializedGetMethod(getCheckURL());
         ExecuteCheckThread t = new ExecuteCheckThread(client,executeMethod);
         try
         {
           t.start();
           t.join();
-          Throwable thr = t.getException();
-          if (thr != null)
-          {
-            if (thr instanceof ManifoldCFException)
-            {
-              if (((ManifoldCFException)thr).getErrorCode() == ManifoldCFException.INTERRUPTED)
-                throw new InterruptedException(thr.getMessage());
-              throw (ManifoldCFException)thr;
-            }
-            else if (thr instanceof ServiceInterruption)
-              throw (ServiceInterruption)thr;
-            else if (thr instanceof IOException)
-              throw (IOException)thr;
-            else if (thr instanceof RuntimeException)
-              throw (RuntimeException)thr;
-            else
-              throw (Error)thr;
-          }
+          handleException(t.getException());
           if (loginAttempted || !t.isLoginRequired())
             return;
         }
@@ -1702,6 +1730,11 @@ public class WikiConnector extends org.a
           t.interrupt();
           throw e;
         }
+	catch (HttpException e)
+	{
+	  t.interrupt();
+	  throw e;
+	}
         catch (InterruptedException e)
         {
           t.interrupt();
@@ -1711,15 +1744,10 @@ public class WikiConnector extends org.a
       }
       catch (InterruptedException e)
       {
-        // Drop the connection on the floor
-        executeMethod = null;
         throw new ManifoldCFException("Interrupted: "+e.getMessage(),e,ManifoldCFException.INTERRUPTED);
       }
       catch (ManifoldCFException e)
       {
-        if (e.getErrorCode() == ManifoldCFException.INTERRUPTED)
-          // Drop the connection on the floor
-          executeMethod = null;
         throw e;
       }
       catch (java.net.SocketTimeoutException e)
@@ -1732,24 +1760,22 @@ public class WikiConnector extends org.a
         long currentTime = System.currentTimeMillis();
         throw new ServiceInterruption("Fetch test received a socket error reading from Wiki server: "+e.getMessage(),e,currentTime+300000L,currentTime+12L * 60000L,-1,false);
       }
-      catch (org.apache.commons.httpclient.ConnectTimeoutException e)
+      catch (ConnectTimeoutException e)
       {
         long currentTime = System.currentTimeMillis();
         throw new ServiceInterruption("Fetch test connection timed out reading from Wiki server: "+e.getMessage(),e,currentTime+300000L,currentTime+12L * 60000L,-1,false);
       }
       catch (InterruptedIOException e)
       {
-        executeMethod = null;
         throw new ManifoldCFException("Interrupted: "+e.getMessage(),e,ManifoldCFException.INTERRUPTED);
       }
       catch (IOException e)
       {
         throw new ManifoldCFException("Fetch test had an IO failure: "+e.getMessage(),e);
       }
-      finally
+      catch (HttpException e)
       {
-        if (executeMethod != null)
-          executeMethod.releaseConnection();
+	throw new ManifoldCFException("Fetch test had Http exception: "+e.getMessage(),e);
       }
       
       if (!loginToAPI())
@@ -1771,11 +1797,11 @@ public class WikiConnector extends org.a
   protected static class ExecuteCheckThread extends Thread
   {
     protected HttpClient client;
-    protected HttpMethodBase executeMethod;
+    protected HttpRequestBase executeMethod;
     protected Throwable exception = null;
     protected boolean loginNeeded = false;
 
-    public ExecuteCheckThread(HttpClient client, HttpMethodBase executeMethod)
+    public ExecuteCheckThread(HttpClient client, HttpRequestBase executeMethod)
     {
       super();
       setDaemon(true);
@@ -1788,11 +1814,11 @@ public class WikiConnector extends org.a
       try
       {
         // Call the execute method appropriately
-        int rval = client.executeMethod(executeMethod);
-        if (rval != 200)
-          throw new ManifoldCFException("Unexpected response code: "+rval);
+        HttpResponse rval = client.execute(executeMethod);
+        if (rval.getStatusLine().getStatusCode() != 200)
+          throw new ManifoldCFException("Unexpected response code: "+rval.getStatusLine().getStatusCode()+": "+readResponseAsString(rval));
         // Read response and make sure it's valid
-        InputStream is = executeMethod.getResponseBodyAsStream();
+        InputStream is = rval.getEntity().getContent();
         try
         {
           loginNeeded = parseCheckResponse(is);
@@ -1813,6 +1839,10 @@ public class WikiConnector extends org.a
       {
         this.exception = e;
       }
+      finally
+      {
+	executeMethod.abort();
+      }
     }
 
     public Throwable getException()
@@ -1997,12 +2027,11 @@ public class WikiConnector extends org.a
     boolean loginAttempted = false;
     while (true)
     {
-      HttpClient client = getInitializedClient();
-      HttpMethodBase executeMethod = getInitializedMethod(getListPagesURL(startPageTitle,namespace,prefix));
       try
       {
+	HttpRequestBase executeMethod = getInitializedGetMethod(getListPagesURL(startPageTitle,namespace,prefix));
         PageBuffer pageBuffer = new PageBuffer();
-        ExecuteListPagesThread t = new ExecuteListPagesThread(client,executeMethod,pageBuffer,startPageTitle);
+        ExecuteListPagesThread t = new ExecuteListPagesThread(httpClient,executeMethod,pageBuffer,startPageTitle);
         try
         {
           t.start();
@@ -2019,24 +2048,7 @@ public class WikiConnector extends org.a
           }
           
           t.join();
-          Throwable thr = t.getException();
-          if (thr != null)
-          {
-            if (thr instanceof ManifoldCFException)
-            {
-              if (((ManifoldCFException)thr).getErrorCode() == ManifoldCFException.INTERRUPTED)
-                throw new InterruptedException(thr.getMessage());
-              throw (ManifoldCFException)thr;
-            }
-            else if (thr instanceof ServiceInterruption)
-              throw (ServiceInterruption)thr;
-            else if (thr instanceof IOException)
-              throw (IOException)thr;
-            else if (thr instanceof RuntimeException)
-              throw (RuntimeException)thr;
-            else
-              throw (Error)thr;
-          }
+          handleException(t.getException());
           if (loginAttempted || !t.isLoginRequired())
             return t.getLastPageTitle();
         }
@@ -2055,6 +2067,11 @@ public class WikiConnector extends org.a
           t.interrupt();
           throw e;
         }
+	catch (HttpException e)
+	{
+	  t.interrupt();
+	  throw e;
+	}
         catch (InterruptedException e)
         {
           t.interrupt();
@@ -2069,15 +2086,11 @@ public class WikiConnector extends org.a
       }
       catch (InterruptedException e)
       {
-        // Drop the connection on the floor
-        executeMethod = null;
         throw new ManifoldCFException("Interrupted: "+e.getMessage(),e,ManifoldCFException.INTERRUPTED);
       }
       catch (ManifoldCFException e)
       {
         if (e.getErrorCode() == ManifoldCFException.INTERRUPTED)
-          // Drop the connection on the floor
-          executeMethod = null;
         throw e;
       }
       catch (java.net.SocketTimeoutException e)
@@ -2090,24 +2103,22 @@ public class WikiConnector extends org.a
         long currentTime = System.currentTimeMillis();
         throw new ServiceInterruption("ListPages received a socket error reading from Wiki server: "+e.getMessage(),e,currentTime+300000L,currentTime+12L * 60000L,-1,false);
       }
-      catch (org.apache.commons.httpclient.ConnectTimeoutException e)
+      catch (ConnectTimeoutException e)
       {
         long currentTime = System.currentTimeMillis();
         throw new ServiceInterruption("ListPages connection timed out reading from Wiki server: "+e.getMessage(),e,currentTime+300000L,currentTime+12L * 60000L,-1,false);
       }
       catch (InterruptedIOException e)
       {
-        executeMethod = null;
         throw new ManifoldCFException("Interrupted: "+e.getMessage(),e,ManifoldCFException.INTERRUPTED);
       }
       catch (IOException e)
       {
         throw new ManifoldCFException("ListPages had an IO failure: "+e.getMessage(),e);
       }
-      finally
+      catch (HttpException e)
       {
-        if (executeMethod != null)
-          executeMethod.releaseConnection();
+	throw new ManifoldCFException("ListPages had an HTTP exception: "+e.getMessage(),e);
       }
       
       if (!loginToAPI())
@@ -2147,14 +2158,14 @@ public class WikiConnector extends org.a
   protected static class ExecuteListPagesThread extends Thread
   {
     protected HttpClient client;
-    protected HttpMethodBase executeMethod;
+    protected HttpRequestBase executeMethod;
     protected Throwable exception = null;
     protected PageBuffer pageBuffer;
     protected String lastPageTitle = null;
     protected String startPageTitle;
     protected boolean loginNeeded = false;
 
-    public ExecuteListPagesThread(HttpClient client, HttpMethodBase executeMethod, PageBuffer pageBuffer, String startPageTitle)
+    public ExecuteListPagesThread(HttpClient client, HttpRequestBase executeMethod, PageBuffer pageBuffer, String startPageTitle)
     {
       super();
       setDaemon(true);
@@ -2169,11 +2180,11 @@ public class WikiConnector extends org.a
       try
       {
         // Call the execute method appropriately
-        int rval = client.executeMethod(executeMethod);
-        if (rval != 200)
-          throw new ManifoldCFException("Unexpected response code: "+rval);
+        HttpResponse rval = client.execute(executeMethod);
+        if (rval.getStatusLine().getStatusCode() != 200)
+          throw new ManifoldCFException("Unexpected response code: "+rval.getStatusLine().getStatusCode()+": "+readResponseAsString(rval));
         // Read response and make sure it's valid
-        InputStream is = executeMethod.getResponseBodyAsStream();
+        InputStream is = rval.getEntity().getContent();
         try
         {
           ReturnString returnString = new ReturnString();
@@ -2199,6 +2210,7 @@ public class WikiConnector extends org.a
       finally
       {
         pageBuffer.signalDone();
+	executeMethod.abort();
       }
     }
 
@@ -2424,33 +2436,15 @@ public class WikiConnector extends org.a
     boolean loginAttempted = false;
     while (true)
     {
-      HttpClient client = getInitializedClient();
-      HttpMethodBase executeMethod = getInitializedMethod(getGetDocURLsURL(documentIdentifiers));
       try
       {
-        ExecuteGetDocURLsThread t = new ExecuteGetDocURLsThread(client,executeMethod,urls);
+	HttpRequestBase executeMethod = getInitializedGetMethod(getGetDocURLsURL(documentIdentifiers));
+        ExecuteGetDocURLsThread t = new ExecuteGetDocURLsThread(httpClient,executeMethod,urls);
         try
         {
           t.start();
           t.join();
-          Throwable thr = t.getException();
-          if (thr != null)
-          {
-            if (thr instanceof ManifoldCFException)
-            {
-              if (((ManifoldCFException)thr).getErrorCode() == ManifoldCFException.INTERRUPTED)
-                throw new InterruptedException(thr.getMessage());
-              throw (ManifoldCFException)thr;
-            }
-            else if (thr instanceof ServiceInterruption)
-              throw (ServiceInterruption)thr;
-            else if (thr instanceof IOException)
-              throw (IOException)thr;
-            else if (thr instanceof RuntimeException)
-              throw (RuntimeException)thr;
-            else
-              throw (Error)thr;
-          }
+          handleException(t.getException());
           if (loginAttempted || !t.isLoginRequired())
             return;
         }
@@ -2469,6 +2463,11 @@ public class WikiConnector extends org.a
           t.interrupt();
           throw e;
         }
+	catch (HttpException e)
+	{
+	  t.interrupt();
+	  throw e;
+	}
         catch (InterruptedException e)
         {
           t.interrupt();
@@ -2478,15 +2477,10 @@ public class WikiConnector extends org.a
       }
       catch (InterruptedException e)
       {
-        // Drop the connection on the floor
-        executeMethod = null;
         throw new ManifoldCFException("Interrupted: "+e.getMessage(),e,ManifoldCFException.INTERRUPTED);
       }
       catch (ManifoldCFException e)
       {
-        if (e.getErrorCode() == ManifoldCFException.INTERRUPTED)
-          // Drop the connection on the floor
-          executeMethod = null;
         throw e;
       }
       catch (java.net.SocketTimeoutException e)
@@ -2499,24 +2493,22 @@ public class WikiConnector extends org.a
         long currentTime = System.currentTimeMillis();
         throw new ServiceInterruption("URL fetch received a socket error reading from Wiki server: "+e.getMessage(),e,currentTime+300000L,currentTime+12L * 60000L,-1,false);
       }
-      catch (org.apache.commons.httpclient.ConnectTimeoutException e)
+      catch (ConnectTimeoutException e)
       {
         long currentTime = System.currentTimeMillis();
         throw new ServiceInterruption("URL fetch connection timed out reading from Wiki server: "+e.getMessage(),e,currentTime+300000L,currentTime+12L * 60000L,-1,false);
       }
       catch (InterruptedIOException e)
       {
-        executeMethod = null;
         throw new ManifoldCFException("Interrupted: "+e.getMessage(),e,ManifoldCFException.INTERRUPTED);
       }
       catch (IOException e)
       {
         throw new ManifoldCFException("URL fetch had an IO failure: "+e.getMessage(),e);
       }
-      finally
+      catch (HttpException e)
       {
-        if (executeMethod != null)
-          executeMethod.releaseConnection();
+	throw new ManifoldCFException("URL fetch had an HTTP exception: "+e.getMessage(),e);
       }
       
       if (!loginToAPI())
@@ -2551,12 +2543,12 @@ public class WikiConnector extends org.a
   protected static class ExecuteGetDocURLsThread extends Thread
   {
     protected HttpClient client;
-    protected HttpMethodBase executeMethod;
+    protected HttpRequestBase executeMethod;
     protected Throwable exception = null;
     protected Map<String,String> urls;
     protected boolean loginNeeded = false;
 
-    public ExecuteGetDocURLsThread(HttpClient client, HttpMethodBase executeMethod, Map<String,String> urls)
+    public ExecuteGetDocURLsThread(HttpClient client, HttpRequestBase executeMethod, Map<String,String> urls)
     {
       super();
       setDaemon(true);
@@ -2570,11 +2562,11 @@ public class WikiConnector extends org.a
       try
       {
         // Call the execute method appropriately
-        int rval = client.executeMethod(executeMethod);
-        if (rval != 200)
-          throw new ManifoldCFException("Unexpected response code: "+rval);
+        HttpResponse rval = client.execute(executeMethod);
+        if (rval.getStatusLine().getStatusCode() != 200)
+          throw new ManifoldCFException("Unexpected response code: "+rval.getStatusLine().getStatusCode()+": "+readResponseAsString(rval));
         // Read response and make sure it's valid
-        InputStream is = executeMethod.getResponseBodyAsStream();
+        InputStream is = rval.getEntity().getContent();
         try
         {
           loginNeeded = parseGetDocURLsResponse(is,urls);
@@ -2595,6 +2587,10 @@ public class WikiConnector extends org.a
       {
         this.exception = e;
       }
+      finally
+      {
+	executeMethod.abort();
+      }
     }
 
     public Throwable getException()
@@ -2758,33 +2754,15 @@ public class WikiConnector extends org.a
     boolean loginAttempted = false;
     while (true)
     {
-      HttpClient client = getInitializedClient();
-      HttpMethodBase executeMethod = getInitializedMethod(getGetTimestampURL(documentIdentifiers));
       try
       {
-        ExecuteGetTimestampThread t = new ExecuteGetTimestampThread(client,executeMethod,versions);
+	HttpRequestBase executeMethod = getInitializedGetMethod(getGetTimestampURL(documentIdentifiers));
+        ExecuteGetTimestampThread t = new ExecuteGetTimestampThread(httpClient,executeMethod,versions);
         try
         {
           t.start();
           t.join();
-          Throwable thr = t.getException();
-          if (thr != null)
-          {
-            if (thr instanceof ManifoldCFException)
-            {
-              if (((ManifoldCFException)thr).getErrorCode() == ManifoldCFException.INTERRUPTED)
-                throw new InterruptedException(thr.getMessage());
-              throw (ManifoldCFException)thr;
-            }
-            else if (thr instanceof ServiceInterruption)
-              throw (ServiceInterruption)thr;
-            else if (thr instanceof IOException)
-              throw (IOException)thr;
-            else if (thr instanceof RuntimeException)
-              throw (RuntimeException)thr;
-            else
-              throw (Error)thr;
-          }
+          handleException(t.getException());
           if (loginAttempted || !t.isLoginRequired())
             return;
         }
@@ -2803,6 +2781,11 @@ public class WikiConnector extends org.a
           t.interrupt();
           throw e;
         }
+	catch (HttpException e)
+	{
+	  t.interrupt();
+	  throw e;
+	}
         catch (InterruptedException e)
         {
           t.interrupt();
@@ -2812,15 +2795,10 @@ public class WikiConnector extends org.a
       }
       catch (InterruptedException e)
       {
-        // Drop the connection on the floor
-        executeMethod = null;
         throw new ManifoldCFException("Interrupted: "+e.getMessage(),e,ManifoldCFException.INTERRUPTED);
       }
       catch (ManifoldCFException e)
       {
-        if (e.getErrorCode() == ManifoldCFException.INTERRUPTED)
-          // Drop the connection on the floor
-          executeMethod = null;
         throw e;
       }
       catch (java.net.SocketTimeoutException e)
@@ -2833,24 +2811,22 @@ public class WikiConnector extends org.a
         long currentTime = System.currentTimeMillis();
         throw new ServiceInterruption("Version fetch received a socket error reading from Wiki server: "+e.getMessage(),e,currentTime+300000L,currentTime+12L * 60000L,-1,false);
       }
-      catch (org.apache.commons.httpclient.ConnectTimeoutException e)
+      catch (ConnectTimeoutException e)
       {
         long currentTime = System.currentTimeMillis();
         throw new ServiceInterruption("Version fetch connection timed out reading from Wiki server: "+e.getMessage(),e,currentTime+300000L,currentTime+12L * 60000L,-1,false);
       }
       catch (InterruptedIOException e)
       {
-        executeMethod = null;
         throw new ManifoldCFException("Interrupted: "+e.getMessage(),e,ManifoldCFException.INTERRUPTED);
       }
       catch (IOException e)
       {
         throw new ManifoldCFException("Version fetch had an IO failure: "+e.getMessage(),e);
       }
-      finally
+      catch (HttpException e)
       {
-        if (executeMethod != null)
-          executeMethod.releaseConnection();
+	throw new ManifoldCFException("Version fetch had an HTTP exception: "+e.getMessage(),e);
       }
       
       if (!loginToAPI())
@@ -2885,12 +2861,12 @@ public class WikiConnector extends org.a
   protected static class ExecuteGetTimestampThread extends Thread
   {
     protected HttpClient client;
-    protected HttpMethodBase executeMethod;
+    protected HttpRequestBase executeMethod;
     protected Throwable exception = null;
     protected Map<String,String> versions;
     protected boolean loginNeeded = false;
 
-    public ExecuteGetTimestampThread(HttpClient client, HttpMethodBase executeMethod, Map<String,String> versions)
+    public ExecuteGetTimestampThread(HttpClient client, HttpRequestBase executeMethod, Map<String,String> versions)
     {
       super();
       setDaemon(true);
@@ -2904,11 +2880,11 @@ public class WikiConnector extends org.a
       try
       {
         // Call the execute method appropriately
-        int rval = client.executeMethod(executeMethod);
-        if (rval != 200)
-          throw new ManifoldCFException("Unexpected response code: "+rval);
+        HttpResponse rval = client.execute(executeMethod);
+        if (rval.getStatusLine().getStatusCode() != 200)
+          throw new ManifoldCFException("Unexpected response code: "+rval.getStatusLine().getStatusCode()+": "+readResponseAsString(rval));
         // Read response and make sure it's valid
-        InputStream is = executeMethod.getResponseBodyAsStream();
+        InputStream is = rval.getEntity().getContent();
         try
         {
           loginNeeded = parseGetTimestampResponse(is,versions);
@@ -2929,6 +2905,10 @@ public class WikiConnector extends org.a
       {
         this.exception = e;
       }
+      finally
+      {
+	executeMethod.abort();
+      }
     }
 
     public Throwable getException()
@@ -3163,35 +3143,16 @@ public class WikiConnector extends org.a
     boolean loginAttempted = false;
     while (true)
     {
-      HttpClient client = getInitializedClient();
-      HttpMethodBase executeMethod = getInitializedMethod(getGetNamespacesURL());
-      
       try
       {
-        ExecuteGetNamespacesThread t = new ExecuteGetNamespacesThread(client,executeMethod,namespaces);
+	HttpRequestBase executeMethod = getInitializedGetMethod(getGetNamespacesURL());
+        ExecuteGetNamespacesThread t = new ExecuteGetNamespacesThread(httpClient,executeMethod,namespaces);
         try
         {
           t.start();
           t.join();
           
-          Throwable thr = t.getException();
-          if (thr != null)
-          {
-            if (thr instanceof ManifoldCFException)
-            {
-              if (((ManifoldCFException)thr).getErrorCode() == ManifoldCFException.INTERRUPTED)
-                throw new InterruptedException(thr.getMessage());
-              throw (ManifoldCFException)thr;
-            }
-            else if (thr instanceof ServiceInterruption)
-              throw (ServiceInterruption)thr;
-            else if (thr instanceof IOException)
-              throw (IOException)thr;
-            else if (thr instanceof RuntimeException)
-              throw (RuntimeException)thr;
-            else
-              throw (Error)thr;
-          }
+          handleException(t.getException());
           if (loginAttempted || !t.isLoginRequired())
             return;
         }
@@ -3210,6 +3171,11 @@ public class WikiConnector extends org.a
           t.interrupt();
           throw e;
         }
+	catch (HttpException e)
+	{
+	  t.interrupt();
+	  throw e;
+	}
         catch (InterruptedException e)
         {
           t.interrupt();
@@ -3219,15 +3185,10 @@ public class WikiConnector extends org.a
       }
       catch (InterruptedException e)
       {
-        // Drop the connection on the floor
-        executeMethod = null;
         throw new ManifoldCFException("Interrupted: "+e.getMessage(),e,ManifoldCFException.INTERRUPTED);
       }
       catch (ManifoldCFException e)
       {
-        if (e.getErrorCode() == ManifoldCFException.INTERRUPTED)
-          // Drop the connection on the floor
-          executeMethod = null;
         throw e;
       }
       catch (java.net.SocketTimeoutException e)
@@ -3240,24 +3201,22 @@ public class WikiConnector extends org.a
         long currentTime = System.currentTimeMillis();
         throw new ServiceInterruption("Get namespaces received a socket error reading from Wiki server: "+e.getMessage(),e,currentTime+300000L,currentTime+12L * 60000L,-1,false);
       }
-      catch (org.apache.commons.httpclient.ConnectTimeoutException e)
+      catch (ConnectTimeoutException e)
       {
         long currentTime = System.currentTimeMillis();
         throw new ServiceInterruption("Get namespaces connection timed out reading from Wiki server: "+e.getMessage(),e,currentTime+300000L,currentTime+12L * 60000L,-1,false);
       }
       catch (InterruptedIOException e)
       {
-        executeMethod = null;
         throw new ManifoldCFException("Interrupted: "+e.getMessage(),e,ManifoldCFException.INTERRUPTED);
       }
       catch (IOException e)
       {
         throw new ManifoldCFException("Get namespaces had an IO failure: "+e.getMessage(),e);
       }
-      finally
+      catch (HttpException e)
       {
-        if (executeMethod != null)
-          executeMethod.releaseConnection();
+	throw new ManifoldCFException("Get namespaces had an HTTP exception: "+e.getMessage(),e);
       }
       
       if (!loginToAPI())
@@ -3270,12 +3229,12 @@ public class WikiConnector extends org.a
   protected static class ExecuteGetNamespacesThread extends Thread
   {
     protected HttpClient client;
-    protected HttpMethodBase executeMethod;
+    protected HttpRequestBase executeMethod;
     protected Throwable exception = null;
     protected Map<String,String> namespaces;
     protected boolean loginNeeded = false;
 
-    public ExecuteGetNamespacesThread(HttpClient client, HttpMethodBase executeMethod, Map<String,String> namespaces)
+    public ExecuteGetNamespacesThread(HttpClient client, HttpRequestBase executeMethod, Map<String,String> namespaces)
     {
       super();
       setDaemon(true);
@@ -3289,14 +3248,14 @@ public class WikiConnector extends org.a
       try
       {
         // Call the execute method appropriately
-        int rval = client.executeMethod(executeMethod);
-        if (rval != 200)
+        HttpResponse rval = client.execute(executeMethod);
+        if (rval.getStatusLine().getStatusCode() != 200)
         {
-          throw new ManifoldCFException("Unexpected response code "+rval+": "+executeMethod.getResponseBodyAsString());
+          throw new ManifoldCFException("Unexpected response code "+rval.getStatusLine().getStatusCode()+": "+readResponseAsString(rval));
         }
 
         // Read response and make sure it's valid
-        InputStream is = executeMethod.getResponseBodyAsStream();
+        InputStream is = rval.getEntity().getContent();
         try
         {
           // Parse the document.  This will cause various things to occur, within the instantiated XMLContext class.
@@ -3350,6 +3309,10 @@ public class WikiConnector extends org.a
       {
         this.exception = e;
       }
+      finally
+      {
+	executeMethod.abort();
+      }
     }
 
     public Throwable getException()
@@ -3515,9 +3478,6 @@ public class WikiConnector extends org.a
     boolean loginAttempted = false;
     while (true)
     {
-      HttpClient client = getInitializedClient();
-      HttpMethodBase executeMethod = getInitializedMethod(getGetDocInfoURL(documentIdentifier));
-      
       String statusCode = "UNKNOWN";
       String errorMessage = null;
       long startTime = System.currentTimeMillis();
@@ -3525,7 +3485,8 @@ public class WikiConnector extends org.a
       
       try
       {
-        ExecuteGetDocInfoThread t = new ExecuteGetDocInfoThread(client,executeMethod,documentIdentifier);
+	HttpRequestBase executeMethod = getInitializedGetMethod(getGetDocInfoURL(documentIdentifier));
+        ExecuteGetDocInfoThread t = new ExecuteGetDocInfoThread(httpClient,executeMethod,documentIdentifier);
         try
         {
           t.start();
@@ -3534,24 +3495,7 @@ public class WikiConnector extends org.a
           statusCode = t.getStatusCode();
           errorMessage = t.getErrorMessage();
             
-          Throwable thr = t.getException();
-          if (thr != null)
-          {
-            if (thr instanceof ManifoldCFException)
-            {
-              if (((ManifoldCFException)thr).getErrorCode() == ManifoldCFException.INTERRUPTED)
-                throw new InterruptedException(thr.getMessage());
-              throw (ManifoldCFException)thr;
-            }
-            else if (thr instanceof ServiceInterruption)
-              throw (ServiceInterruption)thr;
-            else if (thr instanceof IOException)
-              throw (IOException)thr;
-            else if (thr instanceof RuntimeException)
-              throw (RuntimeException)thr;
-            else
-              throw (Error)thr;
-          }
+          handleException(t.getException());
    
           // Fetch all the data we need from the thread, and do the indexing.
           File contentFile = t.getContentFile();
@@ -3620,6 +3564,11 @@ public class WikiConnector extends org.a
           t.interrupt();
           throw e;
         }
+	catch (HttpException e)
+	{
+	  t.interrupt();
+	  throw e;
+	}
         catch (InterruptedException e)
         {
           t.interrupt();
@@ -3634,7 +3583,6 @@ public class WikiConnector extends org.a
       catch (InterruptedException e)
       {
         // Drop the connection on the floor
-        executeMethod = null;
         statusCode = null;
         throw new ManifoldCFException("Interrupted: "+e.getMessage(),e,ManifoldCFException.INTERRUPTED);
       }
@@ -3642,8 +3590,6 @@ public class WikiConnector extends org.a
       {
         if (e.getErrorCode() == ManifoldCFException.INTERRUPTED)
         {
-          // Drop the connection on the floor
-          executeMethod = null;
           statusCode = null;
         }
         throw e;
@@ -3658,14 +3604,13 @@ public class WikiConnector extends org.a
         long currentTime = System.currentTimeMillis();
         throw new ServiceInterruption("Get doc info received a socket error reading from Wiki server: "+e.getMessage(),e,currentTime+300000L,currentTime+12L * 60000L,-1,false);
       }
-      catch (org.apache.commons.httpclient.ConnectTimeoutException e)
+      catch (ConnectTimeoutException e)
       {
         long currentTime = System.currentTimeMillis();
         throw new ServiceInterruption("Get doc info connection timed out reading from Wiki server: "+e.getMessage(),e,currentTime+300000L,currentTime+12L * 60000L,-1,false);
       }
       catch (InterruptedIOException e)
       {
-        executeMethod = null;
         statusCode = null;
         throw new ManifoldCFException("Interrupted: "+e.getMessage(),e,ManifoldCFException.INTERRUPTED);
       }
@@ -3673,10 +3618,12 @@ public class WikiConnector extends org.a
       {
         throw new ManifoldCFException("Get doc info had an IO failure: "+e.getMessage(),e);
       }
+      catch (HttpException e)
+      {
+	throw new ManifoldCFException("Get doc info had an HTTP exception: "+e.getMessage(),e);
+      }
       finally
       {
-        if (executeMethod != null)
-          executeMethod.releaseConnection();
         if (statusCode != null)
           activities.recordActivity(new Long(startTime),ACTIVITY_FETCH,new Long(dataSize),documentIdentifier,statusCode,errorMessage,null);
       }
@@ -3691,7 +3638,7 @@ public class WikiConnector extends org.a
   protected static class ExecuteGetDocInfoThread extends Thread
   {
     protected HttpClient client;
-    protected HttpMethodBase executeMethod;
+    protected HttpRequestBase executeMethod;
     protected Throwable exception = null;
     protected String documentIdentifier;
     protected File contentFile = null;
@@ -3704,7 +3651,7 @@ public class WikiConnector extends org.a
     protected String errorMessage = null;
     protected boolean loginNeeded = false;
 
-    public ExecuteGetDocInfoThread(HttpClient client, HttpMethodBase executeMethod, String documentIdentifier)
+    public ExecuteGetDocInfoThread(HttpClient client, HttpRequestBase executeMethod, String documentIdentifier)
     {
       super();
       setDaemon(true);
@@ -3718,14 +3665,14 @@ public class WikiConnector extends org.a
       try
       {
         // Call the execute method appropriately
-        int rval = client.executeMethod(executeMethod);
-        if (rval != 200)
+        HttpResponse rval = client.execute(executeMethod);
+        if (rval.getStatusLine().getStatusCode() != 200)
         {
-          statusCode = "HTTP code "+rval;
-          throw new ManifoldCFException("Unexpected response code "+rval+": "+executeMethod.getResponseBodyAsString());
+          statusCode = "HTTP code "+rval.getStatusLine().getStatusCode();
+          throw new ManifoldCFException("Unexpected response code "+rval.getStatusLine().getStatusCode()+": "+readResponseAsString(rval));
         }
         // Read response and make sure it's valid
-        InputStream is = executeMethod.getResponseBodyAsStream();
+        InputStream is = rval.getEntity().getContent();
         try
         {
           // Parse the document.  This will cause various things to occur, within the instantiated XMLContext class.
@@ -3757,6 +3704,10 @@ public class WikiConnector extends org.a
               statusCode = "OK";
               loginNeeded = c.isLoginRequired();
             }
+	    catch (InterruptedIOException e)
+	    {
+	      throw e;
+	    }
             catch (IOException e)
             {
               long time = System.currentTimeMillis();
@@ -3786,6 +3737,10 @@ public class WikiConnector extends org.a
         errorMessage = e.getMessage();
         this.exception = e;
       }
+      finally
+      {
+	executeMethod.abort();
+      }
     }
 
     public Throwable getException()
@@ -4334,4 +4289,66 @@ public class WikiConnector extends org.a
     
   }
   
+  protected static String readResponseAsString(HttpResponse httpResponse)
+    throws IOException
+  {
+    HttpEntity entity = httpResponse.getEntity();
+    if (entity != null)
+    {
+      InputStream is = entity.getContent();
+      try
+      {
+        String charSet = EntityUtils.getContentCharSet(entity);
+        if (charSet == null)
+          charSet = "utf-8";
+        char[] buffer = new char[65536];
+        Reader r = new InputStreamReader(is,charSet);
+        Writer w = new StringWriter();
+        try
+        {
+          while (true)
+          {
+            int amt = r.read(buffer);
+            if (amt == -1)
+              break;
+            w.write(buffer,0,amt);
+          }
+        }
+        finally
+        {
+          w.flush();
+        }
+        return w.toString();
+      }
+      finally
+      {
+        is.close();
+      }
+    }
+    return "";
+  }
+  
+  protected static void handleException(Throwable thr)
+    throws InterruptedException, ManifoldCFException, ServiceInterruption, IOException, HttpException
+  {
+    if (thr != null) {
+      if (thr instanceof ManifoldCFException) {
+	if (((ManifoldCFException) thr).getErrorCode() == ManifoldCFException.INTERRUPTED) {
+	  throw new InterruptedException(thr.getMessage());
+	}
+	throw (ManifoldCFException) thr;
+      } else if (thr instanceof ServiceInterruption) {
+	throw (ServiceInterruption) thr;
+      } else if (thr instanceof IOException) {
+	throw (IOException) thr;
+      } else if (thr instanceof HttpException) {
+	throw (HttpException) thr;
+      } else if (thr instanceof RuntimeException) {
+	throw (RuntimeException) thr;
+      } else {
+	throw (Error) thr;
+      }
+    }
+  }
+
 }

Modified: manifoldcf/trunk/connectors/wiki/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/wiki/common_en_US.properties
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/wiki/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/wiki/common_en_US.properties?rev=1411045&r1=1411044&r2=1411045&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/wiki/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/wiki/common_en_US.properties (original)
+++ manifoldcf/trunk/connectors/wiki/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/wiki/common_en_US.properties Mon Nov 19 01:56:35 2012
@@ -23,6 +23,7 @@ WikiConnector.ServerPassword=API passwor
 WikiConnector.ServerDomain=API domain:
 WikiConnector.NamespaceAndTitles=Namespace and Titles
 WikiConnector.NamespaceAndTitles2=Namespaces and titles:
+WikiConnector.Email=Email
 WikiConnector.Namespace=Namespace
 WikiConnector.TitlePrefix=Title prefix
 WikiConnector.Security=Security
@@ -40,6 +41,9 @@ WikiConnector.AllDefaultNamespaceDocumen
 WikiConnector.WikiServerPortMustBeAValidInteger=Wiki server port must be a valid integer
 WikiConnector.PathMustStartWithACharacter=Path must start with a '/' character
 WikiConnector.PleaseSupplyAValidWikiServerName=Please supply a valid Wiki server name
+WikiConnector.NeedAValidEmailAddress=Need a valid email address
+WikiConnector.EmailAddressRequiredToBeIncludedInAllRequestHeaders=Email address required to be included in all request headers
+WikiConnector.EmailAddressToContactColon=Email address to contact:
 WikiConnector.Parameters=Parameters:
 WikiConnector.certificates= certificate(s)
 WikiConnector.DeleteNamespaceTitle=Delete namespace/title #

Modified: manifoldcf/trunk/connectors/wiki/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/wiki/common_ja_JP.properties
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/wiki/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/wiki/common_ja_JP.properties?rev=1411045&r1=1411044&r2=1411045&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/wiki/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/wiki/common_ja_JP.properties (original)
+++ manifoldcf/trunk/connectors/wiki/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/wiki/common_ja_JP.properties Mon Nov 19 01:56:35 2012
@@ -23,6 +23,7 @@ WikiConnector.ServerPassword=API passwor
 WikiConnector.ServerDomain=API domain:
 WikiConnector.NamespaceAndTitles=名前空間と題名
 WikiConnector.NamespaceAndTitles2=名前空間と題名:
+WikiConnector.Email=Email
 WikiConnector.Namespace=名前空間ん
 WikiConnector.TitlePrefix=題名接先頭辞
 WikiConnector.Security=Security
@@ -36,10 +37,13 @@ WikiConnector.Add=追加
 WikiConnector.AddNamespacePrefix=名前空間/接先頭辞の追加
 WikiConnector.UseDefault=デフォルトを使う
 WikiConnector.TransientError=一時的エラー: 
-WikiConnector.=AllDefaultNamespaceDocumentsIncluded=すべてのデフォルト名前空間を含む
+WikiConnector.AllDefaultNamespaceDocumentsIncluded=すべてのデフォルト名前空間を含む
 WikiConnector.WikiServerPortMustBeAValidInteger=Wikiサーバポートには整数を入力してください
 WikiConnector.PathMustStartWithACharacter=パス名の先頭は「/」にしてください
 WikiConnector.PleaseSupplyAValidWikiServerName=正しいWikiサーバ名を入力してください
+WikiConnector.NeedAValidEmailAddress=Need a valid email address
+WikiConnector.EmailAddressRequiredToBeIncludedInAllRequestHeaders=Email address required to be included in all request headers
+WikiConnector.EmailAddressToContactColon=Email address to contact:
 WikiConnector.Parameters=引数:
 WikiConnector.certificates= 証明証
 WikiConnector.DeleteNamespaceTitle=名前空間/題名を削除: #

Modified: manifoldcf/trunk/connectors/wiki/pom.xml
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/wiki/pom.xml?rev=1411045&r1=1411044&r2=1411045&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/wiki/pom.xml (original)
+++ manifoldcf/trunk/connectors/wiki/pom.xml Mon Nov 19 01:56:35 2012
@@ -89,9 +89,9 @@
       <version>${project.version}</version>
     </dependency>
     <dependency>
-      <groupId>commons-httpclient</groupId>
-      <artifactId>commons-httpclient</artifactId>
-      <version>${commons-httpclient.version}</version>
+      <groupId>org.apache.httpcomponents</groupId>
+      <artifactId>httpclient</artifactId>
+      <version>${httpcomponent.version}</version>
     </dependency>
     <dependency>
       <groupId>commons-logging</groupId>