01: // Copyright (C) 2003,2004,2005 by Object Mentor, Inc. All rights reserved.
02: // Released under the terms of the GNU General Public License version 2 or later.
03: package fitnesse.responders.versions;
04:
05: import fitnesse.*;
06: import fitnesse.responders.*;
07: import fitnesse.authentication.*;
08: import fitnesse.components.*;
09: import fitnesse.wiki.*;
10: import fitnesse.http.*;
11:
12: public class RollbackResponder implements SecureResponder {
13: public Response makeResponse(FitNesseContext context,
14: Request request) throws Exception {
15: SimpleResponse response = new SimpleResponse();
16:
17: String resource = request.getResource();
18: String version = (String) request.getInput("version");
19:
20: WikiPagePath path = PathParser.parse(resource);
21: WikiPage page = context.root.getPageCrawler().getPage(
22: context.root, path);
23: if (page == null)
24: return new NotFoundResponder().makeResponse(context,
25: request);
26: PageData data = page.getDataVersion(version);
27:
28: page.commit(data);
29:
30: RecentChanges.updateRecentChanges(data);
31: response.redirect(resource);
32:
33: return response;
34: }
35:
36: public SecureOperation getSecureOperation() {
37: return new SecureWriteOperation();
38: }
39: }
|