Spring for Android

org.springframework.http.converter.feed
Class SyndFeedHttpMessageConverter

java.lang.Object
  extended by org.springframework.http.converter.AbstractHttpMessageConverter<com.google.code.rome.android.repackaged.com.sun.syndication.feed.synd.SyndFeed>
      extended by org.springframework.http.converter.feed.SyndFeedHttpMessageConverter
All Implemented Interfaces:
HttpMessageConverter<com.google.code.rome.android.repackaged.com.sun.syndication.feed.synd.SyndFeed>

public class SyndFeedHttpMessageConverter
extends AbstractHttpMessageConverter<com.google.code.rome.android.repackaged.com.sun.syndication.feed.synd.SyndFeed>

Implementation of HttpMessageConverter that can read and write RSS and ATOM feeds. Specifically, this converter can handle SyndFeed objects, from the Android ROME Feed Reader, which is a repackaging of java.net's ROME.

By default, this converter reads and writes the media types (application/rss+xml and application/atom+xml). This can be overridden by setting the supportedMediaTypes property.

Since:
1.0
Author:
Roy Clarkson
See Also:
SyndFeed

Field Summary
static java.nio.charset.Charset DEFAULT_CHARSET
           
 
Constructor Summary
SyndFeedHttpMessageConverter()
          Constructor that sets the supportedMediaTypes to application/rss+xml and application/atom+xml.
 
Method Summary
protected  com.google.code.rome.android.repackaged.com.sun.syndication.feed.synd.SyndFeed readInternal(java.lang.Class<? extends com.google.code.rome.android.repackaged.com.sun.syndication.feed.synd.SyndFeed> clazz, HttpInputMessage inputMessage)
          Abstract template method that reads the actualy object.
protected  boolean supports(java.lang.Class<?> clazz)
          Indicates whether the given class is supported by this converter.
protected  void writeInternal(com.google.code.rome.android.repackaged.com.sun.syndication.feed.synd.SyndFeed syndFeed, HttpOutputMessage outputMessage)
          Abstract template method that writes the actual body.
 
Methods inherited from class org.springframework.http.converter.AbstractHttpMessageConverter
canRead, canRead, canWrite, canWrite, getContentLength, getDefaultContentType, getSupportedMediaTypes, read, setSupportedMediaTypes, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_CHARSET

public static final java.nio.charset.Charset DEFAULT_CHARSET
Constructor Detail

SyndFeedHttpMessageConverter

public SyndFeedHttpMessageConverter()
Constructor that sets the supportedMediaTypes to application/rss+xml and application/atom+xml.

Method Detail

supports

protected boolean supports(java.lang.Class<?> clazz)
Description copied from class: AbstractHttpMessageConverter
Indicates whether the given class is supported by this converter.

Specified by:
supports in class AbstractHttpMessageConverter<com.google.code.rome.android.repackaged.com.sun.syndication.feed.synd.SyndFeed>
Parameters:
clazz - the class to test for support
Returns:
true if supported; false otherwise

readInternal

protected com.google.code.rome.android.repackaged.com.sun.syndication.feed.synd.SyndFeed readInternal(java.lang.Class<? extends com.google.code.rome.android.repackaged.com.sun.syndication.feed.synd.SyndFeed> clazz,
                                                                                                      HttpInputMessage inputMessage)
                                                                                               throws java.io.IOException,
                                                                                                      HttpMessageNotReadableException
Description copied from class: AbstractHttpMessageConverter
Abstract template method that reads the actualy object. Invoked from AbstractHttpMessageConverter.read(java.lang.Class, org.springframework.http.HttpInputMessage).

Specified by:
readInternal in class AbstractHttpMessageConverter<com.google.code.rome.android.repackaged.com.sun.syndication.feed.synd.SyndFeed>
Parameters:
clazz - the type of object to return
inputMessage - the HTTP input message to read from
Returns:
the converted object
Throws:
java.io.IOException - in case of I/O errors
HttpMessageNotReadableException - in case of conversion errors

writeInternal

protected void writeInternal(com.google.code.rome.android.repackaged.com.sun.syndication.feed.synd.SyndFeed syndFeed,
                             HttpOutputMessage outputMessage)
                      throws java.io.IOException,
                             HttpMessageNotWritableException
Description copied from class: AbstractHttpMessageConverter
Abstract template method that writes the actual body. Invoked from AbstractHttpMessageConverter.write(T, org.springframework.http.MediaType, org.springframework.http.HttpOutputMessage).

Specified by:
writeInternal in class AbstractHttpMessageConverter<com.google.code.rome.android.repackaged.com.sun.syndication.feed.synd.SyndFeed>
Parameters:
syndFeed - the object to write to the output message
outputMessage - the message to write to
Throws:
java.io.IOException - in case of I/O errors
HttpMessageNotWritableException - in case of conversion errors

Spring for Android