aboutsummaryrefslogtreecommitdiff
path: root/juick-server/src/main/java/com
diff options
context:
space:
mode:
Diffstat (limited to 'juick-server/src/main/java/com')
-rw-r--r--juick-server/src/main/java/com/juick/server/api/rss/MessagesView.java11
-rw-r--r--juick-server/src/main/java/com/juick/server/api/rss/RepliesView.java11
2 files changed, 20 insertions, 2 deletions
diff --git a/juick-server/src/main/java/com/juick/server/api/rss/MessagesView.java b/juick-server/src/main/java/com/juick/server/api/rss/MessagesView.java
index f61757a6..3ee458c8 100644
--- a/juick-server/src/main/java/com/juick/server/api/rss/MessagesView.java
+++ b/juick-server/src/main/java/com/juick/server/api/rss/MessagesView.java
@@ -38,6 +38,8 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.servlet.view.feed.AbstractRssFeedView;
+import javax.annotation.Nonnull;
+import javax.annotation.PostConstruct;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.net.URI;
@@ -55,8 +57,15 @@ public class MessagesView extends AbstractRssFeedView {
private static final Logger logger = LoggerFactory.getLogger(MessagesView.class);
+ @PostConstruct
+ public void init() {
+ setContentType("application/rss+xml;charset=UTF-8");
+ }
+
@Override
- protected List<Item> buildFeedItems(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) throws Exception {
+ protected List<Item> buildFeedItems(@Nonnull Map<String, Object> model,
+ @Nonnull HttpServletRequest request,
+ @Nonnull HttpServletResponse response) {
List<Message> msgs = (List<Message>)model.get("messages");
return msgs.stream().map(this::createRssItem).collect(Collectors.toList());
}
diff --git a/juick-server/src/main/java/com/juick/server/api/rss/RepliesView.java b/juick-server/src/main/java/com/juick/server/api/rss/RepliesView.java
index b53e9750..a5411397 100644
--- a/juick-server/src/main/java/com/juick/server/api/rss/RepliesView.java
+++ b/juick-server/src/main/java/com/juick/server/api/rss/RepliesView.java
@@ -34,6 +34,8 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.servlet.view.feed.AbstractRssFeedView;
+import javax.annotation.Nonnull;
+import javax.annotation.PostConstruct;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.net.URI;
@@ -49,8 +51,15 @@ public class RepliesView extends AbstractRssFeedView {
private static final Logger logger = LoggerFactory.getLogger(RepliesView.class);
+ @PostConstruct
+ public void init() {
+ setContentType("application/rss+xml;charset=UTF-8");
+ }
+
@Override
- protected List<Item> buildFeedItems(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) throws Exception {
+ protected List<Item> buildFeedItems(@Nonnull Map<String, Object> model,
+ @Nonnull HttpServletRequest request,
+ @Nonnull HttpServletResponse response) {
List<ResponseReply> msgs = (List<ResponseReply>)model.get("messages");
return msgs.stream().map(this::createRssItem).collect(Collectors.toList());
}