예제 #1
0
 private Response generateXMLResponse(File file) {
   try {
     response.setContent(FileUtil.getFileContent(file));
   } catch (IOException e) {
     response.setContent("Error: Unable to read file '" + file.getName() + "'\n");
   }
   response.setContentType(Format.XML);
   return response;
 }
 private void makeContent(FitNesseContext context, Request request) throws Exception {
   if ("json".equals(request.getInput("format"))) {
     JSONObject jsonObject = makeJson();
     response.setContent(jsonObject.toString(1));
   } else {
     String html = makeHtml(context);
     response.setContent(html);
   }
 }
예제 #3
0
  private void makeContent(FitNesseContext context, Request request) {
    if ("json".equals(request.getInput("format"))) {
      JSONObject jsonObject = makeJson();
      try {
        response.setContent(jsonObject.toString(1));
      } catch (JSONException e) {
        throw new RuntimeException(e);
      }
    } else {
      String html = makeHtml(context, request);

      response.setContent(html);
    }
  }
 public Response makeResponse(FitNesseContext context, Request request) throws Exception {
   SimpleResponse response = new SimpleResponse();
   resource = request.getResource();
   String filename = (String) request.getInput("filename");
   response.setContent(makePageContent(filename, context));
   return response;
 }
예제 #5
0
 public SimpleResponse asResponse() throws Exception {
   byte[] bytes = toByteArray(document);
   SimpleResponse response = new SimpleResponse();
   response.setContent(bytes);
   response.setContentType("text/xml");
   return response;
 }
예제 #6
0
  private Response makePageHistoryXmlResponse(Request request) {
    VelocityContext velocityContext = new VelocityContext();
    velocityContext.put("pageHistory", pageHistory);

    response.setContentType("text/xml");
    response.setContent(context.pageFactory.render(velocityContext, "pageHistoryXML.vm"));
    return response;
  }
 private Response makeBannedContentResponse(FitNesseContext context, String resource) {
   SimpleResponse response = new SimpleResponse();
   HtmlPage html = context.pageFactory.newPage();
   html.setTitle("Edit " + resource);
   html.setPageTitle(new PageTitle("Banned Content", PathParser.parse(resource)));
   html.setMainTemplate("bannedPage.vm");
   response.setContent(html.html());
   return response;
 }
예제 #8
0
  public Response makeResponse(Request request) throws Exception {
    SimpleResponse response = new SimpleResponse();
    resource = this.request.getResource();
    WikiPagePath path = PathParser.parse(resource);
    WikiPage page = root.getPageCrawler().getPage(root, path);
    existingContent = page.getData().getContent();
    newContent = (String) this.request.getInput(EditResponder.CONTENT_INPUT_NAME);

    response.setContent(makePageHtml());

    return response;
  }
  private SimpleResponse makeResponse(
      SuiteOverviewTree treeview, WikiPagePath path, Request request) {
    SimpleResponse response = new SimpleResponse();

    HtmlPage page = context.pageFactory.newPage();
    page.setTitle("Suite Overview");
    page.setPageTitle(new PageTitle("Suite Overview", path));
    page.put("treeRoot", treeview.getTreeRoot());
    page.put("viewLocation", request.getResource());
    page.setMainTemplate("suiteOverview");
    response.setContent(page.html());
    return response;
  }
예제 #10
0
  protected Response doMakeResponse(
      FitNesseContext context, Request request, boolean firstTimeForNewPage) throws Exception {
    initializeResponder(context.root, request);

    SimpleResponse response = new SimpleResponse();
    String resource = request.getResource();
    WikiPagePath path = PathParser.parse(resource);
    PageCrawler crawler = context.root.getPageCrawler();
    if (!crawler.pageExists(root, path)) {
      crawler.setDeadEndStrategy(new MockingPageCrawler());
      page = crawler.getPage(root, path);
    } else page = crawler.getPage(root, path);

    pageData = page.getData();
    content = createPageContent();

    String html = doMakeHtml(resource, context, firstTimeForNewPage);

    response.setContent(html);
    response.setMaxAge(0);

    return response;
  }
예제 #11
0
 private Response makeResponse() {
   response.setContent(page.html());
   return response;
 }