protected byte[] getTextContentAsBytes(String encoding) throws UnsupportedEncodingException { return getPage().getBodyContent().getBody().getBytes(encoding); }
protected InputStream getContentInternal() throws IOException { /* Mostly copied from PageWordExportAction to generate MS Word exports of a page */ Page page = getPage(); PageContext context = page.toPageContext(); Settings globalSettings = settingsManager.getGlobalSettings(); Map<String, Object> contextMap; context.setBaseUrl(globalSettings.getBaseUrl()); context.setSiteRoot(bootstrapManager.getWebAppContextPath()); context.setOutputType(RenderContextOutputType.WORD); context.setLinkRenderer(new WordDocLinkRenderer(context)); String renderedContent = ""; try { renderedContent = xhtmlContent.convertStorageToView(page.getBodyContent().getBody(), new DefaultConversionContext(context)); } catch (XMLStreamException e) { throw new IOException(e); } catch (XhtmlException e) { throw new IOException(e); } contextMap = new HashMap<String, Object>(); contextMap.put("renderedContent", renderedContent); contextMap.put("domainName", globalSettings.getBaseUrl()); contextMap.put("page", page); return new ByteArrayInputStream( VelocityUtils.getRenderedTemplate("templates/extra/webdav/exportword.vm", contextMap).getBytes(globalSettings.getDefaultEncoding())); }
newChildPage.setTitle(generateUniquePageTitle(childPage.getSpaceKey(), childPage.getTitle())); newChildPage.setSpace(childPage.getSpace()); newChildPage.setBodyContent(childPage.getBodyContent()); newChildPage.setParentPage(parent); newChildPage.setCreatorName(user.getName());
newPage.setTitle(uniqueName); newPage.setSpace(targetSpace); newPage.setBodyContent(getPage().getBodyContent()); newPage.setParentPage(parentPage); newPage.setCreatorName(user.getName());