Zip Explorer Plugin

The Zip Explorer Plugin provides an API to create links to files inside a ZIP file. The plugin is enabled by default in XWiki Standard, so you will find it in the "xwiki.plugins" list of the xwiki.cfg file:

xwiki.plugins=\
...
  com.xpn.xwiki.plugin.zipexplorer.ZipExplorerPlugin,\
...

The source code is available on GitHub at xwiki-platform-zipexplorer

The Zip Explorer API lists the content of ZIP attachments (including XAR files) and listens to the XWiki download action in order to display the attachment content. The accepted URLs have the following syntax:

http://[...]/download/WikiPageName/zipfile.zip/FolderName/FileName.txt

Examples

Supposing you have an attachment named "xwiki-commons-component-api-6.1-javadoc.jar" which contains a Javadoc and you want to create a link to the "index.html" file, the "xwiki/2.1" syntax will be:

{{velocity}}
[[XWiki Commons - Component - API 6.1 API Javadoc>>path:$xwiki.zipexplorer.getFileLink($doc,
"xwiki-commons-component-api-6.1-javadoc.jar", "index.html")]]
{{/velocity}}

To list the content of the "xwiki-enterprise-ui-mainwiki-all-6.0.xar" file attached to the current page, use the snippet below:

{{velocity}}
#set($myXAR="xwiki-enterprise-ui-mainwiki-all-6.0.xar")
#set($plugin=$xwiki.zipexplorer)
#foreach($file in $plugin.getFileTreeList($doc, $myXAR))
 * [[$file.id>>path:$plugin.getFileLink($doc, $myXAR, $file.id)]]
#end
{{/velocity}}

The output will then be:

ZipExplorerPlugin.png

 

Related Pages

Search this space

 

Most popular tags

Failed to execute the [groovy] macro
  1. access rights
  2. activity stream
  3. annotation
  4. attachment
  5. comment
  6. Document Tree Macro
  7. export
  8. Extension Manager
  9. Flamingo skin
  10. global user
  11. Groovy event listener
  12. group
  13. nested page
  14. search
  15. skin
  16. syntax
  17. user
  18. user profile
  19. velocity macros
  20. wiki
  21. wysiwyg
  22. XWiki Applications
  23. xwikiattachment_archive table
  24. xwikiattachment table
  25. xwikiattrecyclebin table
  26. xwikiproperties table

[Display all tags from this space]