# HG changeset patch # User Mike Becker # Date 1620898130 -7200 # Node ID 9c7aff3cbb14f1fe6c034c6eb5fefb5fda038815 # Parent 2b3b7d0a885ee7aa339098963517eb1d04733056 #109 - add RSS feed diff -r 2b3b7d0a885e -r 9c7aff3cbb14 src/main/kotlin/de/uapcore/lightpit/RequestMapping.kt --- a/src/main/kotlin/de/uapcore/lightpit/RequestMapping.kt Thu May 13 10:23:37 2021 +0200 +++ b/src/main/kotlin/de/uapcore/lightpit/RequestMapping.kt Thu May 13 11:28:50 2021 +0200 @@ -108,9 +108,13 @@ fun param(name: String): String? = request.getParameter(name) fun paramArray(name: String): Array = request.getParameterValues(name) ?: emptyArray() + fun forward(jsp: String) { + request.getRequestDispatcher(jspPath(jsp)).forward(request, response) + } + fun render(page: String? = null) { page?.let { contentPage = it } - request.getRequestDispatcher(jspPath("site")).forward(request, response) + forward("site") } fun renderCommit(location: String? = null) { diff -r 2b3b7d0a885e -r 9c7aff3cbb14 src/main/kotlin/de/uapcore/lightpit/servlet/FeedServlet.kt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/kotlin/de/uapcore/lightpit/servlet/FeedServlet.kt Thu May 13 11:28:50 2021 +0200 @@ -0,0 +1,51 @@ +/* + * Copyright 2021 Mike Becker. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package de.uapcore.lightpit.servlet + +import de.uapcore.lightpit.AbstractServlet +import de.uapcore.lightpit.HttpRequest +import de.uapcore.lightpit.dao.DataAccessObject +import de.uapcore.lightpit.entities.Issue +import de.uapcore.lightpit.util.IssueFilter +import de.uapcore.lightpit.util.IssueSorter +import de.uapcore.lightpit.viewmodel.IssueFeed +import javax.servlet.annotation.WebServlet + +@WebServlet(urlPatterns = ["/feed/*"]) +class FeedServlet : AbstractServlet() { + + init { + get("/issues.rss", this::issues) + } + + private fun issues(http: HttpRequest, dao: DataAccessObject) { + + val issues = dao.listIssues(IssueFilter()).sortedWith(IssueSorter.DEFAULT_ISSUE_SORTER) + + http.view = IssueFeed(issues.groupBy(Issue::project)) + http.forward("issues-feed") + } +} \ No newline at end of file diff -r 2b3b7d0a885e -r 9c7aff3cbb14 src/main/kotlin/de/uapcore/lightpit/viewmodel/Feeds.kt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/kotlin/de/uapcore/lightpit/viewmodel/Feeds.kt Thu May 13 11:28:50 2021 +0200 @@ -0,0 +1,33 @@ +/* + * Copyright 2021 Mike Becker. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package de.uapcore.lightpit.viewmodel + +import de.uapcore.lightpit.entities.Issue +import de.uapcore.lightpit.entities.Project + +class IssueFeed( + val issues: Map> +) : View() \ No newline at end of file diff -r 2b3b7d0a885e -r 9c7aff3cbb14 src/main/resources/localization/strings.properties --- a/src/main/resources/localization/strings.properties Thu May 13 10:23:37 2021 +0200 +++ b/src/main/resources/localization/strings.properties Thu May 13 11:28:50 2021 +0200 @@ -126,4 +126,6 @@ version.status.Released=Released version.status.Unreleased=Unreleased version.status=Status -version=Version \ No newline at end of file +version=Version +feed.issues.title=LightPIT - Issues +feed.issues.description=Feed about recently updated issues. \ No newline at end of file diff -r 2b3b7d0a885e -r 9c7aff3cbb14 src/main/resources/localization/strings_de.properties --- a/src/main/resources/localization/strings_de.properties Thu May 13 10:23:37 2021 +0200 +++ b/src/main/resources/localization/strings_de.properties Thu May 13 11:28:50 2021 +0200 @@ -99,7 +99,7 @@ no-users=Bislang wurden keine Entwickler hinterlegt. node.tooltip=Name, der zur Konstruktion der URL genutzt werden soll. node=Pfadname -ordinal.tooltip=Use to override lexicographic ordering.=\u00dcbersteuert die lexikographische Sortierung. +ordinal.tooltip=Use to override lexicographic ordering. \u00dcbersteuert die lexikographische Sortierung. ordinal=Sequenznummer placeholder.auto-assignee.tooltip=Weist, wenn m\u00f6glich, den Vorgang dem Leiter der Komponente. placeholder.auto-assignee=Automatisch @@ -127,3 +127,5 @@ version.status.Unreleased=Unver\u00f6ffentlicht version.status=Status version=Version +feed.issues.title=LightPIT - Vorg\u00e4nge +feed.issues.description=Feed \u00fcber k\u00fcrzlich aktualisierte Vorg\u00e4nge. diff -r 2b3b7d0a885e -r 9c7aff3cbb14 src/main/webapp/WEB-INF/jsp/issues-feed.jsp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/webapp/WEB-INF/jsp/issues-feed.jsp Thu May 13 11:28:50 2021 +0200 @@ -0,0 +1,60 @@ +<%-- + ~ Copyright 2021 Mike Becker. All rights reserved. + ~ + ~ Redistribution and use in source and binary forms, with or without + ~ modification, are permitted provided that the following conditions are met: + ~ + ~ 1. Redistributions of source code must retain the above copyright + ~ notice, this list of conditions and the following disclaimer. + ~ + ~ 2. Redistributions in binary form must reproduce the above copyright + ~ notice, this list of conditions and the following disclaimer in the + ~ documentation and/or other materials provided with the distribution. + ~ + ~ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + ~ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + ~ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + ~ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + ~ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + ~ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + ~ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + ~ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + ~ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + ~ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --%> +<%@ page contentType="application/rss+xml;charset=UTF-8" trimDirectiveWhitespaces="true" %> +<%@page import="de.uapcore.lightpit.Constants" %> +<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> + + + + + + + + + + + + <fmt:message key="feed.issues.title"/> - <c:out value="${project.name}"/> + + ${baseHref}projects/${project.node}/ + + ${pageContext.response.locale.language} + + + + <c:if test="${not empty issue.component}"><c:out value="${issue.component.name}"/> - </c:if><c:out value="${issue.subject}"/> + + + + + ${baseHref}projects/${issue.project.node}/issues/-/${empty issue.component ? '-' : issue.component.node}/${issue.id} + ${baseHref}projects/${issue.project.node}/issues/-/-/${issue.id} + + + + + + \ No newline at end of file diff -r 2b3b7d0a885e -r 9c7aff3cbb14 src/main/webapp/WEB-INF/jsp/site.jsp --- a/src/main/webapp/WEB-INF/jsp/site.jsp Thu May 13 10:23:37 2021 +0200 +++ b/src/main/webapp/WEB-INF/jsp/site.jsp Thu May 13 11:28:50 2021 +0200 @@ -48,12 +48,8 @@ <%-- Define an alias for the additional stylesheet --%> -<%-- Apply the session locale (should always be present, but check nevertheless) --%> - - - - <%-- Load resource bundle --%> + @@ -66,6 +62,8 @@ +