Class ZipExplorerPluginAPI


  • @Deprecated
    public class ZipExplorerPluginAPI
    extends PluginApi<ZipExplorerPlugin>
    Deprecated.
    the plugin technology is deprecated, consider rewriting as components
    ZIP-related APIs to list content of a ZIP attachments and to intercept XWiki download requests so that it's possible to display contents found inside ZIP files. This plugin accepts specially formatted URLs pointing to files inside ZIP files by using the following syntax: http://[...]/download/Document/zipfile.zip/SomeDirectory/SomeFile.txt. In this example, the URL points to the SomeFile.txt file located in a directory named SomeDirectory inside a ZIP file named zipfile.zip and attached to the document named Document.
    Version:
    $Id: 8bb7259b921a644b005f31f23ce248a1a651e7e3 $
    See Also:
    ZipExplorerPlugin
    • Constructor Detail

      • ZipExplorerPluginAPI

        public ZipExplorerPluginAPI​(ZipExplorerPlugin plugin,
                                    XWikiContext context)
        Deprecated.
        Parameters:
        plugin - the ZIP Explorer plugin that this class is hiding.
        context - the XWiki context instance containing the last user request
    • Method Detail

      • downloadAttachment

        public XWikiAttachment downloadAttachment​(XWikiAttachment attachment)
        Deprecated.
        For ZIP URLs of the format http://[...]/zipfile.zip/SomeDirectory/SomeFile.txt return a new attachment containing the file pointed to inside the ZIP. If the original attachment does not point to a ZIP file or if it doesn't specify a location inside the ZIP then do nothing and return the original attachment.
        Parameters:
        attachment - the original attachment
        Returns:
        a new attachment pointing to the file pointed to by the URL inside the ZIP or the original attachment if the requested URL doesn't specify a file inside a ZIP
        See Also:
        XWikiDefaultPlugin.downloadAttachment(com.xpn.xwiki.doc.XWikiAttachment, com.xpn.xwiki.XWikiContext)
      • getFileList

        public List<String> getFileList​(Document document,
                                        String attachmentName)
        Deprecated.
        Parameters:
        document - the document containing the ZIP file as an attachment
        attachmentName - the name under which the ZIP file is attached in the document
        Returns:
        the list of file entries in the ZIP file attached under the passed attachment name inside the passed document
      • getFileTreeList

        public List<ListItem> getFileTreeList​(Document document,
                                              String attachmentName)
        Deprecated.
        Finds the ZIP attachment with passed name from the passed document matching and parse the ZIP to generate a list of ListItem elements representing a tree view of all directories and files in the ZIP. For example the following zip:
         zipfile.zip:
           Directory/File.txt
           File2.txt
         
        generates the following ListItem list:
         
           { id = "Directory/", value = "Directory", parent = ""}
           { id = "Directory/File.txt", value = "File.txt", parent = "Directory/"}
           { id = "File2.txt", value = "File2.txt", parent = ""}
         
         
        Parameters:
        document - the document containing the ZIP file as an attachment
        attachmentName - the name under which the ZIP file is attached in the document
        Returns:
        a tree view list of ListItem elements representing the content of the ZIP file
      • getFileLink

        public String getFileLink​(Document document,
                                  String attachmentName,
                                  String fileName)
        Deprecated.
        Parameters:
        document - the document containing the ZIP file as an attachment
        attachmentName - the name under which the ZIP file is attached in the document
        fileName - the filename to concatenate at the end of the attachment URL
        Returns:
        the attachment URL of the passed attachment located in the passed document to which the passed filename has been suffixed.