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); } }
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; }
public SimpleResponse asResponse() throws Exception { byte[] bytes = toByteArray(document); SimpleResponse response = new SimpleResponse(); response.setContent(bytes); response.setContentType("text/xml"); return response; }
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; }
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; }
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; }
private Response makeResponse() { response.setContent(page.html()); return response; }