The Artima Developer Community
Sponsored Link

Java Buzz Forum
Switched to Feedburner

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Nick Lothian

Posts: 397
Nickname: nicklothia
Registered: Jun, 2003

Nick Lothian is Java Developer & Team Leader
Switched to Feedburner Posted: Oct 10, 2006 6:59 AM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Nick Lothian.
Original Post: Switched to Feedburner
Feed Title: BadMagicNumber
Feed URL: http://feeds.feedburner.com/Badmagicnumber
Feed Description: Java, Development and Me
Latest Java Buzz Posts
Latest Java Buzz Posts by Nick Lothian
Latest Posts From BadMagicNumber

Advertisement

I've switched my feeds at my BadMagicNumber blog to be published via FeedBurner. There should be no disruption to your normal programming, although I think some aggregators will show some non-new items as new.

I switched the feeds over using a simple Servlet Filter. If anyone wants to do the same, here's the code. This works for blojsom, but you might need to modify it slightly for your own setup.


public class FeedBurnerRedirectFilter implements Filter {
	private String redirectURL;
	
	public void init(FilterConfig config) throws ServletException {
		redirectURL = config.getInitParameter("redirectURL");		
	}

	public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) 
						throws IOException, ServletException {
		String flavor = request.getParameter("flavor"); 
		
		if ("atom".equals(flavor) || "rss".equals(flavor) 
				|| "rss2".equals(flavor) || "rdf".equals(flavor) ) {			
			HttpServletRequest httpRequest = (HttpServletRequest) request;			
			HttpServletResponse httpResponse = (HttpServletResponse) response;
			
			String userAgent = httpRequest.getHeader("User-Agent");
			if (userAgent != null && userAgent.indexOf("FeedBurner") < 0) {
				/// redirect if not feedburner
				httpResponse.sendRedirect(redirectURL);
				return;				
			}
			
		}		
		chain.doFilter(request, response);		
	}

	public void destroy() {
		
	}
}

Read: Switched to Feedburner

Topic: Lawyers, Guns, and Money Previous Topic   Next Topic Topic: JOLIE 0.2

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use