import org.apache.commons.httpclient.Header;
import org.apache.commons.httpclient.HttpClient;
-import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.HttpMethod;
import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.httpclient.NameValuePair;
* retries.
* @param aClient HTTP client to use.
* @param aMethod Method representing the request.
- * @return XML document describing the response.
+ * @return XML document describing the response.
+ * @throws IOException In case of IO problems.
* @throws TransformerException In case transformation of the HTML to XML fails.
*/
protected Document executeMethod(HttpClient aClient, HttpMethod aMethod)
- throws TransformerException {
+ throws IOException, TransformerException {
int triesLeft = _maxTries;
while (triesLeft > 0) {
triesLeft--;
* @param aClient HTTP client to use.
* @param aMethod Method to execute.
* @return XML document containing the result.
+ * @throws IOException In case of IO problems.
* @throws TransformerException In case transformation of the result to XML fails.
*/
protected Document executeMethodWithoutRetries(HttpClient aClient,
- HttpMethod aMethod) throws TransformerException {
+ HttpMethod aMethod) throws IOException, TransformerException {
try {
aMethod = executeWithRedirects(aClient, aMethod);
byte[] xhtmlData = getXhtml(aMethod);
_os));
return transformed;
- } catch (HttpException e) {
- throw new RuntimeException(e.getMessage(), e);
- } catch (IOException e) {
- throw new RuntimeException(e.getMessage(), e);
} catch (TransformerConfigurationException e) {
throw new RuntimeException(e.getMessage(), e);
} finally {
package org.wamblee.crawler;
+import java.io.IOException;
import java.io.PrintStream;
import javax.xml.transform.TransformerException;
return executeMethod(aClient, method);
} catch (TransformerException e) {
throw new PageException(e.getMessage(), e);
+ } catch (IOException e) {
+ throw new PageException(e.getMessage(), e);
}
}
package org.wamblee.crawler;
+import java.io.IOException;
import java.io.PrintStream;
import javax.xml.transform.TransformerException;
return executeMethod(aClient, method);
} catch (TransformerException e) {
throw new PageException(e.getMessage(), e);
+ } catch (IOException e) {
+ throw new PageException(e.getMessage(), e);
}
}