From 223bd5c1fc0fcca5f2c8f80c20db65cdb6dec5e8 Mon Sep 17 00:00:00 2001 From: Patrick Gotthard Date: Wed, 4 Jun 2014 00:12:25 +0200 Subject: [PATCH 01/10] Prepared release --- pom.xml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index ca16216..afd7833 100644 --- a/pom.xml +++ b/pom.xml @@ -7,10 +7,11 @@ com.rometools rome-parent - 1.5.0-SNAPSHOT + 1.5.0 rome-fetcher + 1.5.0-SNAPSHOT jar rome-fetcher @@ -20,9 +21,9 @@ http://rometools.github.io/rome-fetcher/ - scm:git:git@github.com:rometools/rome-fetcher.git - scm:git:git@github.com:rometools/rome-fetcher.git - https://github.com/rometools/rome-fetcher/ + scm:git:ssh://github.com/rometools/rome-fetcher.git + scm:git:ssh://git@github.com/rometools/rome-fetcher.git + https://github.com/rometools/rome-fetcher From d04127a134fbe67da8a9572ee54cfb2a352fe21c Mon Sep 17 00:00:00 2001 From: Patrick Gotthard Date: Wed, 4 Jun 2014 00:18:35 +0200 Subject: [PATCH 02/10] Prepared release --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index afd7833..892ea3e 100644 --- a/pom.xml +++ b/pom.xml @@ -69,7 +69,7 @@ com.rometools rome - 1.5.0-SNAPSHOT + 1.5.0 commons-httpclient From 7082436dd44b41f1ff2a12fdf605bc118ae4da43 Mon Sep 17 00:00:00 2001 From: Patrick Gotthard Date: Wed, 4 Jun 2014 00:41:15 +0200 Subject: [PATCH 03/10] [maven-release-plugin] prepare release rome-fetcher-1.5.0 --- pom.xml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 892ea3e..5b049b3 100644 --- a/pom.xml +++ b/pom.xml @@ -1,6 +1,5 @@ - + 4.0.0 @@ -11,7 +10,7 @@ rome-fetcher - 1.5.0-SNAPSHOT + 1.5.0 jar rome-fetcher From b475a85f6361f4d9b91c08f7306497610743f255 Mon Sep 17 00:00:00 2001 From: Patrick Gotthard Date: Wed, 4 Jun 2014 00:41:20 +0200 Subject: [PATCH 04/10] [maven-release-plugin] prepare for next development iteration --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 5b049b3..367756c 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ rome-fetcher - 1.5.0 + 1.6.0-SNAPSHOT jar rome-fetcher From 2f9ca08ab7eccf08b6019789ffb0d9120873f06a Mon Sep 17 00:00:00 2001 From: Patrick Gotthard Date: Wed, 4 Jun 2014 00:42:48 +0200 Subject: [PATCH 05/10] [maven-release-plugin] prepare release rome-fetcher-1.5.0 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 367756c..5b049b3 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ rome-fetcher - 1.6.0-SNAPSHOT + 1.5.0 jar rome-fetcher From ab7afae21bd38d587515926c4a5b32c098f2b03f Mon Sep 17 00:00:00 2001 From: Patrick Gotthard Date: Wed, 4 Jun 2014 00:47:47 +0200 Subject: [PATCH 06/10] Prepared release --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 5b049b3..3133ba0 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ rome-fetcher - 1.5.0 + 1.5.0-SNAPSHOT jar rome-fetcher From 9886ad4d6ad766e116a0d85c4752779cf710cb23 Mon Sep 17 00:00:00 2001 From: Patrick Gotthard Date: Wed, 4 Jun 2014 00:48:48 +0200 Subject: [PATCH 07/10] [maven-release-plugin] prepare release rome-fetcher-1.5.0 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 3133ba0..5b049b3 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ rome-fetcher - 1.5.0-SNAPSHOT + 1.5.0 jar rome-fetcher From a20898e4721e7b156e84d56f1c2d187845ba25a5 Mon Sep 17 00:00:00 2001 From: Patrick Gotthard Date: Wed, 4 Jun 2014 00:48:53 +0200 Subject: [PATCH 08/10] [maven-release-plugin] prepare for next development iteration --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 5b049b3..367756c 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ rome-fetcher - 1.5.0 + 1.6.0-SNAPSHOT jar rome-fetcher From 1c7452bef70652faa3f3bbe8cffbc6ad05fd6321 Mon Sep 17 00:00:00 2001 From: Patrick Gotthard Date: Wed, 4 Jun 2014 22:20:29 +0200 Subject: [PATCH 09/10] Prepared next development version --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 367756c..f9044c5 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.rometools rome-parent - 1.5.0 + 1.6.0-SNAPSHOT rome-fetcher @@ -68,7 +68,7 @@ com.rometools rome - 1.5.0 + 1.6.0-SNAPSHOT commons-httpclient From df75a19d3b95f16f422131533629e2c0570f49cd Mon Sep 17 00:00:00 2001 From: Aaron Rankin Date: Fri, 3 Oct 2014 16:33:58 -0500 Subject: [PATCH 10/10] allow for custom request headers to be passed through the the http method call --- .../fetcher/impl/HttpClientFeedFetcher.java | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/rometools/fetcher/impl/HttpClientFeedFetcher.java b/src/main/java/com/rometools/fetcher/impl/HttpClientFeedFetcher.java index 5e7b82f..eaa989b 100644 --- a/src/main/java/com/rometools/fetcher/impl/HttpClientFeedFetcher.java +++ b/src/main/java/com/rometools/fetcher/impl/HttpClientFeedFetcher.java @@ -21,6 +21,7 @@ import java.io.InputStream; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; +import java.util.Map; import java.util.zip.GZIPInputStream; import org.apache.commons.httpclient.Credentials; @@ -48,6 +49,7 @@ public class HttpClientFeedFetcher extends AbstractFeedFetcher { private FeedFetcherCache feedInfoCache; private volatile HttpClientMethodCallbackIntf httpClientMethodCallback; private volatile HttpClientParams httpClientParams; + private Map customRequestHeaders; public HttpClientFeedFetcher() { setHttpClientParams(new HttpClientParams()); @@ -151,6 +153,14 @@ public class HttpClientFeedFetcher extends AbstractFeedFetcher { public int getReadTimeout() { return getHttpClientParams().getSoTimeout(); } + + /** + * Apply any request headers to the HTTP method call. + * @param customRequestHeaders + */ + public synchronized void setCustomRequestHeaders(final Map customRequestHeaders) { + this.customRequestHeaders = customRequestHeaders; + } @Override public SyndFeed retrieveFeed(final URL url) throws IllegalArgumentException, IOException, FeedException, FetcherException { @@ -187,8 +197,18 @@ public class HttpClientFeedFetcher extends AbstractFeedFetcher { final String urlStr = feedUrl.toString(); final HttpMethod method = new GetMethod(urlStr); - method.addRequestHeader("Accept-Encoding", "gzip"); - method.addRequestHeader("User-Agent", userAgent); + if (customRequestHeaders == null) { + method.addRequestHeader("Accept-Encoding", "gzip"); + method.addRequestHeader("User-Agent", userAgent); + + } else { + for (final Map.Entry entry : customRequestHeaders.entrySet()) { + method.addRequestHeader(entry.getKey(), entry.getValue()); + } + if (!customRequestHeaders.containsKey("Accept-Encoding")) method.addRequestHeader("Accept-Encoding", "gzip"); + if (!customRequestHeaders.containsKey("User-Agent")) method.addRequestHeader("User-Agent", userAgent); + } + method.setFollowRedirects(true); if (httpClientMethodCallback != null) {