@GET @Produces(MediaType.TEXT_HTML) public Response downloadContent() { try { loadContent(); return Response.ok(content).build(); } catch (IOException e) { logger.error("Could not load content", e); return Response.serverError().entity(e).build(); } }
@DefaultHandler public Resolution execute() throws IOException { loadContent(); if (StringUtils.isEmpty(content)) { content = "<em>Empty content. To add content, configure this page.</em>"; } return new ForwardResolution("/m/pageactions/text/read.jsp"); }
@Button(list = "pageHeaderButtons", titleKey = "edit", order = 2, icon = Button.ICON_EDIT, group = "pageHeaderButtons") @RequiresPermissions(level = AccessLevel.VIEW, permissions = { PERMISSION_EDIT }) @RequiresAuthentication public Resolution configure() { title = pageInstance.getPage().getTitle(); description = pageInstance.getPage().getDescription(); try { loadContent(); logger.debug("Edit content: {}", textFile.getAbsolutePath()); } catch (IOException e) { logger.error("Could not load content", e); SessionMessages.addErrorMessage("Could not load content: " + e); } return new ForwardResolution("/m/pageactions/text/edit-content.jsp"); }