java - Apache Camel RSS module with basic authentication -
i trying use apache camel's rss module use basic authentication protected rss feed endpoint. however, can't find documentation how pass user credentials. know how this? workarounds appreciated!
i think it's not possible @ moment. camel-rss uses rome read rss feeds. take code of org.apache.camel.component.rss.rssutils
:
public static syndfeed createfeed(string feeduri, classloader classloader) throws exception { classloader tccl = thread.currentthread().getcontextclassloader(); try { thread.currentthread().setcontextclassloader(classloader); inputstream in = new url(feeduri).openstream(); syndfeedinput input = new syndfeedinput(); return input.build(new xmlreader(in)); } { thread.currentthread().setcontextclassloader(tccl); } }
to use basic authentication there must like
public static syndfeed createfeed(string feeduri, classloader classloader) throws exception { classloader tccl = thread.currentthread().getcontextclassloader(); try { thread.currentthread().setcontextclassloader(classloader); url feedurl = new url(feeduri); httpurlconnection httpcon = (httpurlconnection)feedurl.openconnection(); string encoding = new sun.misc.base64encoder().encode("username:password".getbytes()); httpcon.setrequestproperty ("authorization", "basic " + encoding); syndfeedinput input = new syndfeedinput(); return input.build(new xmlreader(httpcon)); } { thread.currentthread().setcontextclassloader(tccl); } }
this way described here --> rome-xmlreader-not-reading-https-feed
i opened new ticket feature. --> camel-9009
Comments
Post a Comment