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

public abstract Class AbstractAtomFeedView

extends AbstractFeedView<Feed>
Class Inheritance
Imports
java.util.List, .Map, com.rometools.rome.feed.atom.Entry, .Feed, jakarta.servlet.http.HttpServletRequest, .HttpServletResponse

Abstract superclass for Atom 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 buildFeedEntries.

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

Authors
Arjen Poutsma, Juergen Hoeller
Since
3.0
See Also
buildFeedMetadata, buildFeedEntries, Atom Syndication Format

Field Summary

Modifier and TypeField and Description
public static final String
DEFAULT_FEED_TYPE

The default feed type used.

private String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected final void
buildFeedEntries(Map<String, Object>
the model Map
model
,
Feed
the feed to add entries to
feed
,
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 buildFeedEntries(Map, HttpServletRequest, HttpServletResponse) to get a list of feed entries.

protected abstract List<Entry>

Returns:

the feed entries to be added to the feed
buildFeedEntries
(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 entries, given the model.

protected Feed
newFeed()

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

Create a new Feed instance to hold the entries.

public void
setFeedType(String feedType)

Set the Rome feed type to use.

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

Field Detail

DEFAULT_FEED_TYPEback to summary
public static final String DEFAULT_FEED_TYPE

The default feed type used.

feedTypeback to summary
private String feedType

Constructor Detail

AbstractAtomFeedViewback to summary
public AbstractAtomFeedView()

Method Detail

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

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

Invokes buildFeedEntries(Map, HttpServletRequest, HttpServletResponse) to get a list of feed entries.

Parameters
model:Map<String, Object>

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

the model Map

feed:Feed

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

buildFeedEntriesback to summary
protected abstract List<Entry> buildFeedEntries(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) throws Exception

Subclasses must implement this method to build feed entries, 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<Entry>

the feed entries to be added to the feed

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

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

Create a new Feed instance to hold the entries.

By default returns an Atom 1.0 feed, but the subclass can specify any Feed.

Returns:Feed

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

the newly created Feed instance

Annotations
@Override
See Also
setFeedType(String)
setFeedTypeback to summary
public void setFeedType(String feedType)

Set the Rome feed type to use.

Defaults to Atom 1.0.

See Also
Feed#setFeedType(String), DEFAULT_FEED_TYPE