Search in sources :

Example 1 with HtmlPackager

use of com.xpn.xwiki.export.html.HtmlPackager in project xwiki-platform by xwiki.

the class ExportAction method exportHTML.

/**
 * Create ZIP archive containing wiki pages rendered in HTML, attached files and used skins.
 *
 * @param context the XWiki context.
 * @return always return null.
 * @throws XWikiException error when exporting HTML ZIP package.
 * @throws IOException error when exporting HTML ZIP package.
 * @since XWiki Platform 1.3M1
 */
private String exportHTML(XWikiContext context) throws XWikiException, IOException {
    XWikiRequest request = context.getRequest();
    String description = request.get("description");
    String name = request.get("name");
    if (StringUtils.isBlank(name)) {
        name = context.getDoc().getFullName();
    }
    Collection<DocumentReference> pageList = resolvePagesToExport(request.getParameterValues("pages"), context);
    if (pageList.isEmpty()) {
        return null;
    }
    HtmlPackager packager = new HtmlPackager();
    if (name != null && name.trim().length() > 0) {
        packager.setName(name);
    }
    if (description != null) {
        packager.setDescription(description);
    }
    packager.addPageReferences(pageList);
    packager.export(context);
    return null;
}
Also used : HtmlPackager(com.xpn.xwiki.export.html.HtmlPackager) DocumentReference(org.xwiki.model.reference.DocumentReference)

Aggregations

HtmlPackager (com.xpn.xwiki.export.html.HtmlPackager)1 DocumentReference (org.xwiki.model.reference.DocumentReference)1