01: /**
02: * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE, version 2.1, dated February 1999.
03: *
04: * This program is free software; you can redistribute it and/or modify
05: * it under the terms of the latest version of the GNU Lesser General
06: * Public License as published by the Free Software Foundation;
07: *
08: * This program is distributed in the hope that it will be useful,
09: * but WITHOUT ANY WARRANTY; without even the implied warranty of
10: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11: * GNU Lesser General Public License for more details.
12: *
13: * You should have received a copy of the GNU Lesser General Public License
14: * along with this program (LICENSE.txt); if not, write to the Free Software
15: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16: */package org.jamwiki.servlets;
17:
18: import java.util.Collection;
19:
20: import javax.servlet.http.HttpServletRequest;
21: import javax.servlet.http.HttpServletResponse;
22:
23: import org.jamwiki.WikiBase;
24: import org.jamwiki.WikiMessage;
25: import org.jamwiki.utils.Pagination;
26: import org.jamwiki.utils.WikiLogger;
27: import org.jamwiki.utils.WikiUtil;
28: import org.springframework.web.servlet.ModelAndView;
29:
30: /**
31: * Used to display a summary of edits made, ordered chronologically.
32: */
33: public class RecentChangesServlet extends JAMWikiServlet {
34:
35: private static final WikiLogger logger = WikiLogger
36: .getLogger(RecentChangesServlet.class.getName());
37: protected static final String JSP_RECENT_CHANGES = "recent-changes.jsp";
38:
39: /**
40: *
41: */
42: protected ModelAndView handleJAMWikiRequest(
43: HttpServletRequest request, HttpServletResponse response,
44: ModelAndView next, WikiPageInfo pageInfo) throws Exception {
45: this .recentChanges(request, next, pageInfo);
46: return next;
47: }
48:
49: /**
50: *
51: */
52: private void recentChanges(HttpServletRequest request,
53: ModelAndView next, WikiPageInfo pageInfo) throws Exception {
54: String virtualWiki = WikiUtil.getVirtualWikiFromURI(request);
55: Pagination pagination = ServletUtil.loadPagination(request,
56: next);
57: Collection changes = WikiBase.getDataHandler()
58: .getRecentChanges(virtualWiki, pagination, true);
59: next.addObject("changes", changes);
60: next.addObject("numChanges", new Integer(changes.size()));
61: pageInfo.setPageTitle(new WikiMessage("recentchanges.title"));
62: pageInfo.setContentJsp(JSP_RECENT_CHANGES);
63: pageInfo.setSpecial(true);
64: }
65: }
|