Author: tobr
Date: Wed Jan 30 10:09:38 2013
New Revision: 1440326
URL: http://svn.apache.org/viewvc?rev=1440326&view=rev
Log:
set params for the http client
removed unused files
Removed:
incubator/droids/branches/0.2.x-cleanup/droids-crawler/src/main/java/org/apache/droids/fetcher/DroidsHttpClient.java
incubator/droids/branches/0.2.x-cleanup/droids-crawler/src/main/java/org/apache/droids/protocol/
Modified:
incubator/droids/branches/0.2.x-cleanup/droids-crawler/src/main/java/org/apache/droids/fetcher/CrawlingFetcher.java
Modified:
incubator/droids/branches/0.2.x-cleanup/droids-crawler/src/main/java/org/apache/droids/fetcher/CrawlingFetcher.java
URL:
http://svn.apache.org/viewvc/incubator/droids/branches/0.2.x-cleanup/droids-crawler/src/main/java/org/apache/droids/fetcher/CrawlingFetcher.java?rev=1440326&r1=1440325&r2=1440326&view=diff
==============================================================================
---
incubator/droids/branches/0.2.x-cleanup/droids-crawler/src/main/java/org/apache/droids/fetcher/CrawlingFetcher.java
(original)
+++
incubator/droids/branches/0.2.x-cleanup/droids-crawler/src/main/java/org/apache/droids/fetcher/CrawlingFetcher.java
Wed Jan 30 10:09:38 2013
@@ -13,7 +13,6 @@ import org.apache.http.client.methods.Ht
import org.apache.http.impl.client.SystemDefaultHttpClient;
import org.apache.http.params.CoreConnectionPNames;
import org.apache.http.params.CoreProtocolPNames;
-import org.apache.http.params.HttpParams;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -43,6 +42,7 @@ public class CrawlingFetcher implements
this.httpClient = new SystemDefaultHttpClient();
this.contentLoader = new HttpClientContentLoader(httpClient);
this.userAgent = userAgent;
+ setDroidsHttpParams();
}
@Override
@@ -81,10 +81,10 @@ public class CrawlingFetcher implements
HttpGet httpget = new HttpGet(task.getURI());
HttpResponse response = httpClient.execute(httpget);
StatusLine statusline = response.getStatusLine();
-// if (statusline.getStatusCode() >= HttpStatus.SC_BAD_REQUEST) {
-// httpget.abort();
-// throw new HttpResponseException(statusline.getStatusCode(),
statusline.getReasonPhrase());
-// }
+ if (statusline.getStatusCode() >= HttpStatus.SC_BAD_REQUEST) {
+ httpget.abort();
+ throw new HttpResponseException(statusline.getStatusCode(),
statusline.getReasonPhrase());
+ }
HttpEntity entity = response.getEntity();
if (entity != null) {
InputStream instream = entity.getContent();
@@ -95,7 +95,7 @@ public class CrawlingFetcher implements
}
}
- public void setDefaultHttpParams(HttpParams params) {
+ private void setDroidsHttpParams() {
httpClient.getParams().setParameter(CoreProtocolPNames.USER_AGENT,
userAgent);
httpClient.getParams().setParameter(CoreProtocolPNames.USE_EXPECT_CONTINUE,
false);
httpClient.getParams().setParameter(CoreConnectionPNames.STALE_CONNECTION_CHECK,
false);