Filter Stream Script API
Last modified by Admin on 2024/12/27 00:39
Exposes the Filter Stream API to Scripts |
Type | JAR |
Category | |
Developed by | |
Rating | |
License | GNU Lesser General Public License 2.1 |
Bundled With | XWiki Standard |
Compatibility | Introduced in 6.2 |
Table of contents
Description
The entry point for using Filter module from scripts is the filter script service.
Examples
Import a XAR from attachment
{{velocity}}
#set($inputProperties = {
'source' : $doc.getAttachment('myattached.xar').getContentInputStream()
})
#set($outputProperties = {})
#set($job = $services.filter.convert('xwiki+xar/1.2', $inputProperties, 'xwiki+instance', $outputProperties))
{{/velocity}}
#set($inputProperties = {
'source' : $doc.getAttachment('myattached.xar').getContentInputStream()
})
#set($outputProperties = {})
#set($job = $services.filter.convert('xwiki+xar/1.2', $inputProperties, 'xwiki+instance', $outputProperties))
{{/velocity}}
Note that you can also get some logs displayed with:
{{template name="job_macros.vm"/}}
{{velocity}}
#set($inputProperties = {
'source' : $doc.getAttachment('myattached.xar').getContentInputStream()
})
#set($outputProperties = {})
#set($job = $services.filter.convert('xwiki+xar/1.2', $inputProperties, 'xwiki+instance', $outputProperties))
{{html}}
#printStatusLog($job.status)
{{/html}}
{{/velocity}}
{{velocity}}
#set($inputProperties = {
'source' : $doc.getAttachment('myattached.xar').getContentInputStream()
})
#set($outputProperties = {})
#set($job = $services.filter.convert('xwiki+xar/1.2', $inputProperties, 'xwiki+instance', $outputProperties))
{{html}}
#printStatusLog($job.status)
{{/html}}
{{/velocity}}
Example result:
Prerequisites & Installation Instructions
We recommend using the Extension Manager to install this extension (Make sure that the text "Installable with the Extension Manager" is displayed at the top right location on this page to know if this extension can be installed with the Extension Manager).
You can also use the manual method which involves dropping the JAR file and all its dependencies into the WEB-INF/lib folder and restarting XWiki.
Dependencies
Dependencies for this extension (org.xwiki.platform:xwiki-platform-filter-script 16.10.2):
- org.xwiki.commons:xwiki-commons-filter-api 16.10.2
- org.xwiki.commons:xwiki-commons-script 16.10.2
- org.xwiki.platform:xwiki-platform-security-authorization-api 16.10.2
- org.xwiki.platform:xwiki-platform-oldcore 16.10.2