[tor-bugs] #23854 [Metrics/Website]: Add an RSS feed for https://metrics.torproject.org/news.html
Tor Bug Tracker & Wiki
blackhole at torproject.org
Sun Mar 18 21:12:11 UTC 2018
#23854: Add an RSS feed for https://metrics.torproject.org/news.html
-----------------------------+--------------------------
Reporter: cypherpunks | Owner: irl
Type: enhancement | Status: accepted
Priority: Medium | Milestone:
Component: Metrics/Website | Version:
Severity: Normal | Resolution:
Keywords: | Actual Points:
Parent ID: | Points:
Reviewer: | Sponsor:
-----------------------------+--------------------------
Comment (by irl):
Done a little hacking on this, I think my plan looks like:
* Add a formatAsFeedItem method to `org.torproject.metrics.web.News`
* Point the resource `/feed.xml` at `NewsServlet`
* Add a JSP named `feed.jsp`, which is used instead of `news.jsp` to
render the feed version
* Implement only ATOM (RFC4287), not RSS, as ATOM has far better support
for internationalisation that may be used later, where internationalising
RSS may hold back that work
This would be the way to do it to match the way the news page is currently
built. I do wonder though if perhaps we should instead refactor the way
the news page works:
* Remove the formatAsTableRow method from
`org.torproject.metrics.web.News`
* Make getters for `org.torproject.metrics.news.News` public
* Re-implement formatAsTableRow using JSTL in `news.jsp`
* Point the resource `/feed.xml` at `NewsServlet`
* Add a `feed.jsp` using JSTL
We definitely do not need to add ROME, or a similar library, at least for
now. As an example to get an idea, the RSS 0.91 hacky JSP (where I made
getDescription public so that it could be available):
{{{
<%@ page contentType="text/xml" %><?xml version="1.0"?>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<rss version="0.91">
<channel>
<title>Tor Metrics - News</title>
<link>https://metrics.torproject.org/</link>
<c:forEach var="entry" items="${news}">
<item>
<title>
<c:out value="${entry.description}"/>
</title>
</item>
</c:forEach>
</channel>
}}}
karsten, iwakeh - Which approach do you think would be best?
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/23854#comment:4>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
More information about the tor-bugs
mailing list