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;
04:
05: import fitnesse.*;
06: import fitnesse.authentication.*;
07: import fitnesse.html.*;
08: import fitnesse.http.*;
09:
10: public class ShutdownResponder implements SecureResponder {
11: public Response makeResponse(FitNesseContext context,
12: Request request) throws Exception {
13: SimpleResponse response = new SimpleResponse();
14:
15: HtmlPage html = context.htmlPageFactory.newPage();
16: html.title.use("Shutdown");
17: html.header.use(HtmlUtil.makeSpanTag("page_title", "Shutdown"));
18:
19: HtmlTag content = HtmlUtil.makeDivTag("centered");
20: content.add(new HtmlTag("h3", "FitNesse is shutting down..."));
21:
22: html.main.use(content);
23: response.setContent(html.html());
24:
25: final FitNesse fitnesseInstance = context.fitnesse;
26:
27: Thread shutdownThread = new Thread() {
28: public void run() {
29: try {
30: fitnesseInstance.stop();
31: } catch (Exception e) {
32: e.printStackTrace();
33: }
34: }
35: };
36: shutdownThread.start();
37:
38: return response;
39: }
40:
41: public SecureOperation getSecureOperation() {
42: return new AlwaysSecureOperation();
43: }
44: }
|