Top Description Constructors Methods
org.springframework.web.servlet.view.feed

public abstract Class AbstractRssFeedView

extends AbstractFeedView<Channel>
Class Inheritance
Imports
java.util.List, .Map, com.rometools.rome.feed.rss.Channel, .Item, jakarta.servlet.http.HttpServletRequest, .HttpServletResponse, org.springframework.http.MediaType

Abstract superclass for RSS Feed views, using the ROME package.

Note

As of Spring 4.1, this is based on the com.rometools variant of ROME, version 1.5. Please upgrade your build dependency.

Application-specific view classes will extend this class. The view will be held in the subclass itself, not in a template. Main entry points are the buildFeedMetadata and buildFeedItems.

Thanks to Jettro Coenradie and Sergio Bossa for the original feed view prototype!

Authors
Arjen Poutsma, Juergen Hoeller
Since
3.0
See Also
buildFeedMetadata, buildFeedItems

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected final void
buildFeedEntries(Map<String, Object>
the model Map
model
,
Channel
the feed to add entries to
channel
,
HttpServletRequest
in case we need locale etc. Shouldn't look at attributes.
request
,
HttpServletResponse
in case we need to set cookies. Shouldn't write to it.
response
)

Implements abstract org.springframework.web.servlet.view.feed.AbstractFeedView.buildFeedEntries.

Invokes buildFeedItems(Map, HttpServletRequest, HttpServletResponse) to get a list of feed items.

protected abstract List<Item>

Returns:

the feed items to be added to the feed
buildFeedItems
(Map<String, Object>
the model Map
model
,
HttpServletRequest
in case we need locale etc. Shouldn't look at attributes.
request
,
HttpServletResponse
in case we need to set cookies. Shouldn't write to it.
response
)

Subclasses must implement this method to build feed items, given the model.

protected Channel
newFeed()

Implements abstract org.springframework.web.servlet.view.feed.AbstractFeedView.newFeed.

Create a new Channel instance to hold the entries.

Inherited from org.springframework.web.servlet.view.feed.AbstractFeedView:
buildFeedMetadatarenderMergedOutputModel

Constructor Detail

AbstractRssFeedViewback to summary
public AbstractRssFeedView()

Method Detail

buildFeedEntriesback to summary
protected final void buildFeedEntries(Map<String, Object> model, Channel channel, HttpServletRequest request, HttpServletResponse response) throws Exception

Implements abstract org.springframework.web.servlet.view.feed.AbstractFeedView.buildFeedEntries.

Invokes buildFeedItems(Map, HttpServletRequest, HttpServletResponse) to get a list of feed items.

Parameters
model:Map<String, Object>

Doc from org.springframework.web.servlet.view.feed.AbstractFeedView.buildFeedEntries.

the model Map

channel:Channel

Doc from org.springframework.web.servlet.view.feed.AbstractFeedView.buildFeedEntries.

the feed to add entries to

request:HttpServletRequest

Doc from org.springframework.web.servlet.view.feed.AbstractFeedView.buildFeedEntries.

in case we need locale etc. Shouldn't look at attributes.

response:HttpServletResponse

Doc from org.springframework.web.servlet.view.feed.AbstractFeedView.buildFeedEntries.

in case we need to set cookies. Shouldn't write to it.

Annotations
@Override
Exceptions
Exception:

Doc from org.springframework.web.servlet.view.feed.AbstractFeedView.buildFeedEntries.

any exception that occurred during building

buildFeedItemsback to summary
protected abstract List<Item> buildFeedItems(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) throws Exception

Subclasses must implement this method to build feed items, given the model.

Note that the passed-in HTTP response is just supposed to be used for setting cookies or other HTTP headers. The built feed itself will automatically get written to the response after this method returns.

Parameters
model:Map<String, Object>

the model Map

request:HttpServletRequest

in case we need locale etc. Shouldn't look at attributes.

response:HttpServletResponse

in case we need to set cookies. Shouldn't write to it.

Returns:List<Item>

the feed items to be added to the feed

Exceptions
Exception:
any exception that occurred during document building
See Also
Item
newFeedback to summary
protected Channel newFeed()

Implements abstract org.springframework.web.servlet.view.feed.AbstractFeedView.newFeed.

Create a new Channel instance to hold the entries.

By default returns an RSS 2.0 channel, but the subclass can specify any channel.

Returns:Channel

Doc from org.springframework.web.servlet.view.feed.AbstractFeedView.newFeed.

the newly created Feed instance

Annotations
@Override