You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by olivierursushorribilis <ol...@gmail.com> on 2012/03/16 18:40:26 UTC
Camel RSS Component and ? char in URL feed
Hi,
my RSS feed URL is :
http://unevieagrimper.blogspot.com/feeds/posts/default?alt=rss
To me, this URL is quite valid : many RSS feed (thousands !) are using such
URL suffix (?xx=xx).
When i try to use Camel RSS Component i get an error :
rss:http://unevieagrimper.blogspot.com/feeds/posts/default?alt=rss?splitEntries=false&consumer.delay=1000
Since ? is a special char for camel URI it causes trouble.
Then, i tried :
rss:http://unevieagrimper.blogspot.com/feeds/posts/default%3Falt=rss?splitEntries=false&consumer.delay=1000
But, it does not work since %3F is not decoded when Camel RSS tries to get
data from this URL.
What is the proper way to get Camel RSS working with this URL ?
I've patched (quick and dirty for testing purpose) the
org.apache.camel.component.rss.RssUtils class :
package org.apache.camel.component.rss;
import java.io.InputStream;
import java.net.URL;
import com.sun.syndication.feed.synd.SyndFeed;
import com.sun.syndication.io.SyndFeedInput;
import com.sun.syndication.io.XmlReader;
public final class RssUtils {
private RssUtils() {
// Helper class
}
public static SyndFeed createFeed(String feedUri) throws Exception {
String uri = feedUri;
if(feedUri.contains("%3F")){
uri = feedUri.replace("%3F","?");
}
InputStream in = new URL(uri).openStream();
SyndFeedInput input = new SyndFeedInput();
return input.build(new XmlReader(in));
}
}
The patch handle the encoded %3F.
Thanks.
--
View this message in context: http://camel.465427.n5.nabble.com/Camel-RSS-Component-and-char-in-URL-feed-tp5572015p5572015.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Camel RSS Component and ? char in URL feed
Posted by Claus Ibsen <cl...@gmail.com>.
On Sat, Mar 17, 2012 at 8:28 AM, olivierursushorribilis
<ol...@gmail.com> wrote:
> The ? indicates the start of the query of the uri
>> http://en.wikipedia.org/wiki/URI_scheme#Generic_syntax
>>
>> Thanks for this.
>
>
>> So in your case you should use & to separate values, so it should be:
>> rss:
>> http://unevieagrimper.blogspot.com/feeds/posts/default?alt=rss&splitEntries=false&consumer.delay=1000
>>
>> Yes it works, thanks a lot you save my life ! ;o))))
>
> Maybe you can add an example of this in Camel RSS Component doc, it not as
> obvious as it looks.
>
I updated the documentation with a tip about this
http://camel.apache.org/rss
> Thanks again.
>
>
>
>>
>> On Fri, Mar 16, 2012 at 6:40 PM, olivierursushorribilis
>> <[hidden email] <http://user/SendEmail.jtp?type=node&node=5572052&i=0>>
>> wrote:
>>
>> > Hi,
>> >
>> > my RSS feed URL is :
>> > http://unevieagrimper.blogspot.com/feeds/posts/default?alt=rss
>> >
>> > To me, this URL is quite valid : many RSS feed (thousands !) are using
>> such
>> > URL suffix (?xx=xx).
>> >
>> > When i try to use Camel RSS Component i get an error :
>> >
>> > rss:
>> http://unevieagrimper.blogspot.com/feeds/posts/default?alt=rss?splitEntries=false&consumer.delay=1000
>> >
>> > Since ? is a special char for camel URI it causes trouble.
>> >
>> > Then, i tried :
>> >
>> > rss:
>> http://unevieagrimper.blogspot.com/feeds/posts/default%3Falt=rss?splitEntries=false&consumer.delay=1000
>> >
>> >
>> > But, it does not work since %3F is not decoded when Camel RSS tries to
>> get
>> > data from this URL.
>> >
>> > What is the proper way to get Camel RSS working with this URL ?
>> >
>> >
>> > I've patched (quick and dirty for testing purpose) the
>> > org.apache.camel.component.rss.RssUtils class :
>> >
>> >
>> > package org.apache.camel.component.rss;
>> >
>> > import java.io.InputStream;
>> > import java.net.URL;
>> >
>> > import com.sun.syndication.feed.synd.SyndFeed;
>> > import com.sun.syndication.io.SyndFeedInput;
>> > import com.sun.syndication.io.XmlReader;
>> >
>> > public final class RssUtils {
>> > private RssUtils() {
>> > // Helper class
>> > }
>> >
>> > public static SyndFeed createFeed(String feedUri) throws Exception {
>> > String uri = feedUri;
>> > if(feedUri.contains("%3F")){
>> > uri = feedUri.replace("%3F","?");
>> > }
>> > InputStream in = new URL(uri).openStream();
>> > SyndFeedInput input = new SyndFeedInput();
>> > return input.build(new XmlReader(in));
>> > }
>> > }
>> >
>> > The patch handle the encoded %3F.
>> >
>> >
>> > Thanks.
>> >
>> >
>> >
>> > --
>> > View this message in context:
>> http://camel.465427.n5.nabble.com/Camel-RSS-Component-and-char-in-URL-feed-tp5572015p5572015.html
>> > Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
>> FuseSource
>> Email: [hidden email]<http://user/SendEmail.jtp?type=node&node=5572052&i=1>
>> Web: http://fusesource.com
>> Twitter: davsclaus, fusenews
>> Blog: http://davsclaus.blogspot.com/
>> Author of Camel in Action: http://www.manning.com/ibsen/
>>
>>
>> ------------------------------
>> If you reply to this email, your message will be added to the discussion
>> below:
>>
>> http://camel.465427.n5.nabble.com/Camel-RSS-Component-and-char-in-URL-feed-tp5572015p5572052.html
>> To unsubscribe from Camel RSS Component and ? char in URL feed, click
>> here<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5572015&code=b2xpdmllcnVyc3VzaG9ycmliaWxpc0BnbWFpbC5jb218NTU3MjAxNXwxNjM1ODQ5ODc4>
>> .
>> NAML<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-RSS-Component-and-char-in-URL-feed-tp5572015p5573189.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
--
Claus Ibsen
-----------------
CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/
Re: Camel RSS Component and ? char in URL feed
Posted by olivierursushorribilis <ol...@gmail.com>.
The ? indicates the start of the query of the uri
> http://en.wikipedia.org/wiki/URI_scheme#Generic_syntax
>
> Thanks for this.
> So in your case you should use & to separate values, so it should be:
> rss:
> http://unevieagrimper.blogspot.com/feeds/posts/default?alt=rss&splitEntries=false&consumer.delay=1000
>
> Yes it works, thanks a lot you save my life ! ;o))))
Maybe you can add an example of this in Camel RSS Component doc, it not as
obvious as it looks.
Thanks again.
>
> On Fri, Mar 16, 2012 at 6:40 PM, olivierursushorribilis
> <[hidden email] <http://user/SendEmail.jtp?type=node&node=5572052&i=0>>
> wrote:
>
> > Hi,
> >
> > my RSS feed URL is :
> > http://unevieagrimper.blogspot.com/feeds/posts/default?alt=rss
> >
> > To me, this URL is quite valid : many RSS feed (thousands !) are using
> such
> > URL suffix (?xx=xx).
> >
> > When i try to use Camel RSS Component i get an error :
> >
> > rss:
> http://unevieagrimper.blogspot.com/feeds/posts/default?alt=rss?splitEntries=false&consumer.delay=1000
> >
> > Since ? is a special char for camel URI it causes trouble.
> >
> > Then, i tried :
> >
> > rss:
> http://unevieagrimper.blogspot.com/feeds/posts/default%3Falt=rss?splitEntries=false&consumer.delay=1000
> >
> >
> > But, it does not work since %3F is not decoded when Camel RSS tries to
> get
> > data from this URL.
> >
> > What is the proper way to get Camel RSS working with this URL ?
> >
> >
> > I've patched (quick and dirty for testing purpose) the
> > org.apache.camel.component.rss.RssUtils class :
> >
> >
> > package org.apache.camel.component.rss;
> >
> > import java.io.InputStream;
> > import java.net.URL;
> >
> > import com.sun.syndication.feed.synd.SyndFeed;
> > import com.sun.syndication.io.SyndFeedInput;
> > import com.sun.syndication.io.XmlReader;
> >
> > public final class RssUtils {
> > private RssUtils() {
> > // Helper class
> > }
> >
> > public static SyndFeed createFeed(String feedUri) throws Exception {
> > String uri = feedUri;
> > if(feedUri.contains("%3F")){
> > uri = feedUri.replace("%3F","?");
> > }
> > InputStream in = new URL(uri).openStream();
> > SyndFeedInput input = new SyndFeedInput();
> > return input.build(new XmlReader(in));
> > }
> > }
> >
> > The patch handle the encoded %3F.
> >
> >
> > Thanks.
> >
> >
> >
> > --
> > View this message in context:
> http://camel.465427.n5.nabble.com/Camel-RSS-Component-and-char-in-URL-feed-tp5572015p5572015.html
> > Sent from the Camel - Users mailing list archive at Nabble.com.
>
>
>
> --
> Claus Ibsen
> -----------------
> CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
> FuseSource
> Email: [hidden email]<http://user/SendEmail.jtp?type=node&node=5572052&i=1>
> Web: http://fusesource.com
> Twitter: davsclaus, fusenews
> Blog: http://davsclaus.blogspot.com/
> Author of Camel in Action: http://www.manning.com/ibsen/
>
>
> ------------------------------
> If you reply to this email, your message will be added to the discussion
> below:
>
> http://camel.465427.n5.nabble.com/Camel-RSS-Component-and-char-in-URL-feed-tp5572015p5572052.html
> To unsubscribe from Camel RSS Component and ? char in URL feed, click
> here<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5572015&code=b2xpdmllcnVyc3VzaG9ycmliaWxpc0BnbWFpbC5jb218NTU3MjAxNXwxNjM1ODQ5ODc4>
> .
> NAML<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>
--
View this message in context: http://camel.465427.n5.nabble.com/Camel-RSS-Component-and-char-in-URL-feed-tp5572015p5573189.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Camel RSS Component and ? char in URL feed
Posted by Claus Ibsen <cl...@gmail.com>.
The ? indicates the start of the query of the uri
http://en.wikipedia.org/wiki/URI_scheme#Generic_syntax
So in your case you should use & to separate values, so it should be:
rss:http://unevieagrimper.blogspot.com/feeds/posts/default?alt=rss&splitEntries=false&consumer.delay=1000
On Fri, Mar 16, 2012 at 6:40 PM, olivierursushorribilis
<ol...@gmail.com> wrote:
> Hi,
>
> my RSS feed URL is :
> http://unevieagrimper.blogspot.com/feeds/posts/default?alt=rss
>
> To me, this URL is quite valid : many RSS feed (thousands !) are using such
> URL suffix (?xx=xx).
>
> When i try to use Camel RSS Component i get an error :
>
> rss:http://unevieagrimper.blogspot.com/feeds/posts/default?alt=rss?splitEntries=false&consumer.delay=1000
>
> Since ? is a special char for camel URI it causes trouble.
>
> Then, i tried :
>
> rss:http://unevieagrimper.blogspot.com/feeds/posts/default%3Falt=rss?splitEntries=false&consumer.delay=1000
>
>
> But, it does not work since %3F is not decoded when Camel RSS tries to get
> data from this URL.
>
> What is the proper way to get Camel RSS working with this URL ?
>
>
> I've patched (quick and dirty for testing purpose) the
> org.apache.camel.component.rss.RssUtils class :
>
>
> package org.apache.camel.component.rss;
>
> import java.io.InputStream;
> import java.net.URL;
>
> import com.sun.syndication.feed.synd.SyndFeed;
> import com.sun.syndication.io.SyndFeedInput;
> import com.sun.syndication.io.XmlReader;
>
> public final class RssUtils {
> private RssUtils() {
> // Helper class
> }
>
> public static SyndFeed createFeed(String feedUri) throws Exception {
> String uri = feedUri;
> if(feedUri.contains("%3F")){
> uri = feedUri.replace("%3F","?");
> }
> InputStream in = new URL(uri).openStream();
> SyndFeedInput input = new SyndFeedInput();
> return input.build(new XmlReader(in));
> }
> }
>
> The patch handle the encoded %3F.
>
>
> Thanks.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-RSS-Component-and-char-in-URL-feed-tp5572015p5572015.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
--
Claus Ibsen
-----------------
CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/