// Copyright (C) 2003-2009 by Object Mentor, Inc. All rights reserved.
// Released under the terms of the CPL Common Public License version 1.0.
package fitnesse.responders;
import fitnesse.FitNesseContext;
import fitnesse.authentication.SecureOperation;
import fitnesse.authentication.SecureReadOperation;
import fitnesse.authentication.SecureResponder;
import fitnesse.http.Request;
import fitnesse.http.Response;
import fitnesse.http.SimpleResponse;
import fitnesse.wiki.PageData;
import fitnesse.wiki.PathParser;
import fitnesse.wiki.WikiPage;
import fitnesse.wiki.WikiPagePath;
public class RawContentResponder implements SecureResponder {
public Response makeResponse(FitNesseContext context, Request request) {
String resource = request.getResource();
WikiPagePath path = PathParser.parse(resource);
WikiPage page = context.root.getPageCrawler().getPage(path);
if (page == null)
return new NotFoundResponder().makeResponse(context, request);
PageData pageData = page.getData();
SimpleResponse response = new SimpleResponse();
response.setMaxAge(0);
response.setContent(pageData.getContent());
return response;
}
public SecureOperation getSecureOperation() {
return new SecureReadOperation();
}
}