Wiki source code of Exports

Last modified by Simon Urli on 2026/10/15 11:35

Hide last authors
Simon Urli 1.1 1 The ##export## action of ##xwiki-platform-oldcore##, at URLs such as ##/xwiki/bin/export/Space/Page?format=xar##, exports Pages in the format named by the ##format## request parameter, ##xar## being the default. It handles ##xar##, ##html##, ##pdf## and, when an office server is connected, office formats such as ##odt## or ##rtf## itself, and an extension adds or replaces a format with an [[Export Format Handler>>doc:documentation.xs.dev.exports.format-handler-api.WebHome]] component.
2
3 {{version since="18.4.7, 18.9.0RC1"}}
4 The export action performs an export only for a POST request. Any other request gets the 405 (Method Not Allowed) status code, an ##Allow: POST## header and the [["Confirm the Export" page>>doc:documentation.xs.user.exports.export-page.confirm-export.WebHome]], which submits the same parameters again with a POST request. A handler decides for itself which requests it accepts: the ##html-print## format, which the PDF export loads in a browser, accepts GET requests because it only renders a Page.
5 {{/version}}
6
7 {{plantuml}}
8 @startuml
9 !theme bluegray
10 start
11 :request to /bin/export/…?format=F;
12 if (ExportFormatHandler with hint F (default xar)?) then (yes)
13 if (handler.validate(request)) then (true)
14 :handler.export(context);
15 stop
16 else (false)
17 endif
18 else (no)
19 if (POST request?) then (yes)
20 :native export (xar, html, pdf, office);
21 stop
22 else (no)
23 endif
24 endif
25 :405 + Allow: POST + "Confirm the Export" page;
26 stop
27 @enduml
28 {{/plantuml}}
29
30 [[Add an Export Format>>doc:documentation.xs.dev.exports.add-format.WebHome]] plugs a format into both the export action and the Export modal.

Get Connected