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.files;
04:
05: import fitnesse.*;
06: import fitnesse.responders.SecureResponder;
07: import fitnesse.authentication.*;
08: import fitnesse.http.*;
09: import java.io.File;
10:
11: public class CreateDirectoryResponder implements SecureResponder {
12: public Response makeResponse(FitNesseContext context,
13: Request request) throws Exception {
14: SimpleResponse response = new SimpleResponse();
15:
16: String resource = request.getResource();
17: String dirname = (String) request.getInput("dirname");
18: String pathname = context.rootPagePath + "/" + resource
19: + dirname;
20: File file = new File(pathname);
21: if (!file.exists())
22: file.mkdir();
23:
24: response.redirect("/" + resource);
25: return response;
26: }
27:
28: public SecureOperation getSecureOperation() {
29: return new AlwaysSecureOperation();
30: }
31: }
|