camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From olivierursushorribilis <olivierursushorribi...@gmail.com>
Subject Camel RSS Component and ? char in URL feed
Date Fri, 16 Mar 2012 17:40:26 GMT
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.

Mime
View raw message