Implement atom feeds

This commit is contained in:
kaakaa
2014-03-08 23:43:23 +09:00
parent ec0c964ceb
commit 3bff6a1949
6 changed files with 46 additions and 0 deletions

View File

@@ -143,6 +143,9 @@ case class Context(settings: SystemSettingsService.SystemSettings, loginAccount:
lazy val currentPath = request.getRequestURI.substring(request.getContextPath.length)
lazy val baseURL = request.getRequestURL.substring(0, request.getRequestURL.length - request.getRequestURI.length) + path
lazy val host = request.getServerName
/**
* Get object from cache.
*

View File

@@ -46,6 +46,11 @@ trait IndexControllerBase extends ControllerBase {
redirect("/")
}
get("/activities.atom"){
contentType = "application/atom+xml; type=feed"
xml.feed(getRecentActivities())
}
/**
* Set account information into HttpSession and redirect.
*/

View File

@@ -15,6 +15,11 @@ object helpers extends AvatarImageProvider with LinkConverter with RequestCache
*/
def datetime(date: Date): String = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(date)
/**
* Format java.util.Date to "yyyy-MM-dd'T'hh:mm:ss'Z'".
*/
def datetimeRFC3339(date: Date): String = new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ss'Z'").format(date).replaceAll("(\\d\\d)(\\d\\d)$","$1:$2")
/**
* Format java.util.Date to "yyyy-MM-dd".
*/