The challenge – java.io.IOException: Server returned HTTP response code: 403 for URL
Remember my post Reading/Parsing RSS and Atom feeds in Java with Rome, remember how I build SyndFeed
objects out of a feed’s URL:
public SyndFeed getSyndFeedForUrl(String url) throws MalformedURLException, IOException, IllegalArgumentException, FeedException { SyndFeed feed = null; InputStream is = null; try { URLConnection openConnection = new URL(url).openConnection(); is = new URL(url).openConnection().getInputStream(); if("gzip".equals(openConnection.getContentEncoding())){ is = new GZIPInputStream(is); } InputSource source = new InputSource(is); SyndFeedInput input = new SyndFeedInput(); feed = input.build(source); } catch (Exception e){ LOG.error("Exception occured when building the feed object out of the url", e); } finally { if( is != null) is.close(); } return feed; }