Package org.restlet.engine.local
Class ZipClientHelper
- java.lang.Object
-
- org.restlet.engine.Helper
-
- org.restlet.engine.RestletHelper<T>
-
- org.restlet.engine.connector.ConnectorHelper<Client>
-
- org.restlet.engine.connector.ClientHelper
-
- org.restlet.engine.local.LocalClientHelper
-
- org.restlet.engine.local.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 Summary
Constructors Constructor Description ZipClientHelper(Client client)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidhandleGet(Request request, Response response, java.io.File file, java.lang.String entryName, MetadataService metadataService)Handles a GET call.protected voidhandleLocal(Request request, Response response, java.lang.String decodedPath)Handles a call for a local entity.protected voidhandlePut(Request request, Response response, java.io.File file, java.lang.String entryName)Handles a PUT call.private booleanwriteEntityStream(Representation entity, java.util.zip.ZipOutputStream out, java.lang.String entryName)Writes an entity to a given ZIP output stream with a given ZIP entry name.-
Methods inherited from class org.restlet.engine.local.LocalClientHelper
getDefaultLanguage, getTimeToLive, handle
-
Methods inherited from class org.restlet.engine.connector.ConnectorHelper
getConnectorService, getContext, getProtocols, start, stop, update
-
Methods inherited from class org.restlet.engine.RestletHelper
getAttributes, getHelped, getHelpedParameters, getLogger, getMetadataService, setHelped
-
-
-
-
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:
handleLocalin classLocalClientHelper- 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
-
-