Class ZipClientHelper


  • public class ZipClientHelper
    extends LocalClientHelper
    ZIP and JAR client connector. Only works for archives available as local files.

    Handles GET, HEAD and PUT request on resources referenced as : zip:file://
    • Constructor Detail

      • ZipClientHelper

        public ZipClientHelper​(Client client)
        Constructor.
        Parameters:
        client - The helped client.
    • Method Detail

      • handleLocal

        protected void handleLocal​(Request request,
                                   Response response,
                                   java.lang.String decodedPath)
        Handles a call for a local entity. By default, only GET and HEAD methods are implemented.
        Specified by:
        handleLocal in class LocalClientHelper
        Parameters:
        request - The request to handle.
        response - The response to update.
        decodedPath - The URL decoded entity path.
      • handleGet

        protected void handleGet​(Request request,
                                 Response response,
                                 java.io.File file,
                                 java.lang.String entryName,
                                 MetadataService metadataService)
        Handles a GET call.
        Parameters:
        request - The request to answer.
        response - The response to update.
        file - The Zip archive file.
        entryName - The Zip archive entry name.
        metadataService - The metadata service.
      • handlePut

        protected void handlePut​(Request request,
                                 Response response,
                                 java.io.File file,
                                 java.lang.String entryName)
        Handles a PUT call.
        Parameters:
        request - The request to answer.
        response - The response to update.
        file - The Zip archive file.
        entryName - The Zip archive entry name.
      • writeEntityStream

        private boolean writeEntityStream​(Representation entity,
                                          java.util.zip.ZipOutputStream out,
                                          java.lang.String entryName)
                                   throws java.io.IOException
        Writes an entity to a given ZIP output stream with a given ZIP entry name.
        Parameters:
        entity - The entity to write.
        out - The ZIP output stream.
        entryName - The ZIP entry name.
        Returns:
        True if the writing was successful.
        Throws:
        java.io.IOException