Polishing

(cherry picked from commit ede2150)
This commit is contained in:
Juergen Hoeller
2014-07-02 17:32:43 +02:00
parent 010d8b8c89
commit fe72fcede5
13 changed files with 68 additions and 84 deletions

View File

@@ -72,7 +72,7 @@ import org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolv
/**
* A {@link BeanDefinitionParser} that provides the configuration for the
* {@code <annotation-driven/>} MVC namespace element.
* {@code <annotation-driven/>} MVC namespace element.
*
* <p>This class registers the following {@link HandlerMapping}s:</p>
* <ul>

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2008 the original author or authors.
* Copyright 2002-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,7 +21,6 @@ import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.sun.syndication.feed.WireFeed;
import com.sun.syndication.feed.atom.Entry;
import com.sun.syndication.feed.atom.Feed;
@@ -31,17 +30,15 @@ import com.sun.syndication.feed.atom.Feed;
*
* <p>Application-specific view classes will extend this class.
* The view will be held in the subclass itself, not in a template.
*
* <p>Main entry points are the {@link #buildFeedMetadata(Map, WireFeed, HttpServletRequest)} and
* {@link #buildFeedEntries(Map, HttpServletRequest, HttpServletResponse)}.
* Main entry points are the {@link #buildFeedMetadata} and {@link #buildFeedEntries}.
*
* <p>Thanks to Jettro Coenradie and Sergio Bossa for the original feed view prototype!
*
* @author Arjen Poutsma
* @author Juergen Hoeller
* @since 3.0
* @see #buildFeedMetadata(Map, WireFeed, HttpServletRequest)
* @see #buildFeedEntries(Map, HttpServletRequest, HttpServletResponse)
* @see #buildFeedMetadata
* @see #buildFeedEntries
* @see <a href="http://www.atomenabled.org/developers/syndication/">Atom Syndication Format</a>
*/
public abstract class AbstractAtomFeedView extends AbstractFeedView<Feed> {
@@ -56,7 +53,7 @@ public abstract class AbstractAtomFeedView extends AbstractFeedView<Feed> {
}
/**
* Sets the Rome feed type to use.
* Set the Rome feed type to use.
* <p>Defaults to Atom 1.0.
* @see Feed#setFeedType(String)
* @see #DEFAULT_FEED_TYPE
@@ -96,7 +93,7 @@ public abstract class AbstractAtomFeedView extends AbstractFeedView<Feed> {
* @param request in case we need locale etc. Shouldn't look at attributes.
* @param response in case we need to set cookies. Shouldn't write to it.
* @return the feed entries to be added to the feed
* @throws Exception any exception that occured during document building
* @throws Exception any exception that occurred during document building
* @see Entry
*/
protected abstract List<Entry> buildFeedEntries(

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2009 the original author or authors.
* Copyright 2002-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,7 +21,6 @@ import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.sun.syndication.feed.WireFeed;
import com.sun.syndication.feed.rss.Channel;
import com.sun.syndication.feed.rss.Item;
@@ -31,17 +30,15 @@ import com.sun.syndication.feed.rss.Item;
*
* <p>Application-specific view classes will extend this class.
* The view will be held in the subclass itself, not in a template.
*
* <p>Main entry points are the {@link #buildFeedMetadata(Map, WireFeed , HttpServletRequest)}
* and {@link #buildFeedItems(Map, HttpServletRequest, HttpServletResponse)}.
* Main entry points are the {@link #buildFeedMetadata} and {@link #buildFeedItems}.
*
* <p>Thanks to Jettro Coenradie and Sergio Bossa for the original feed view prototype!
*
* @author Arjen Poutsma
* @author Juergen Hoeller
* @since 3.0
* @see #buildFeedMetadata(Map, WireFeed , HttpServletRequest)
* @see #buildFeedItems(Map, HttpServletRequest, HttpServletResponse)
* @see #buildFeedMetadata
* @see #buildFeedItems
*/
public abstract class AbstractRssFeedView extends AbstractFeedView<Channel> {
@@ -79,7 +76,7 @@ public abstract class AbstractRssFeedView extends AbstractFeedView<Channel> {
* @param request in case we need locale etc. Shouldn't look at attributes.
* @param response in case we need to set cookies. Shouldn't write to it.
* @return the feed items to be added to the feed
* @throws Exception any exception that occured during document building
* @throws Exception any exception that occurred during document building
* @see Item
*/
protected abstract List<Item> buildFeedItems(

View File

@@ -1,8 +1,8 @@
/**
*
* Support classes for feed generation, providing View implementations for Atom and RSS
* Support classes for feed generation, providing View implementations for Atom and RSS.
* Based on the <a href="https://rome.dev.java.net/">ROME tools</a> project.
*
*/
package org.springframework.web.servlet.view.feed;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -67,6 +67,7 @@ public class AtomFeedViewTests {
assertXMLEqual(expected, response.getContentAsString());
}
private static class MyAtomFeedView extends AbstractAtomFeedView {
@Override
@@ -90,4 +91,5 @@ public class AtomFeedViewTests {
return entries;
}
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright ${YEAR} the original author or authors.
* Copyright 2002-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,7 +17,6 @@
package org.springframework.web.servlet.view.feed;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@@ -48,7 +47,6 @@ public class RssFeedViewTests {
public void createView() throws Exception {
view = new MyRssFeedView();
setIgnoreWhitespace(true);
}
@Test
@@ -69,6 +67,7 @@ public class RssFeedViewTests {
assertXMLEqual(expected, response.getContentAsString());
}
private static class MyRssFeedView extends AbstractRssFeedView {
@Override
@@ -79,11 +78,9 @@ public class RssFeedViewTests {
}
@Override
protected List<Item> buildFeedItems(Map model, HttpServletRequest request, HttpServletResponse response)
throws Exception {
protected List<Item> buildFeedItems(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) throws Exception {
List<Item> items = new ArrayList<Item>();
for (Iterator iterator = model.keySet().iterator(); iterator.hasNext();) {
String name = (String) iterator.next();
for (String name : model.keySet()) {
Item item = new Item();
item.setTitle(name);
Description description = new Description();
@@ -94,4 +91,5 @@ public class RssFeedViewTests {
return items;
}
}
}