Class Handler

java.lang.Object
java.net.URLStreamHandler
org.archive.net.md5.Handler

public class Handler extends URLStreamHandler
A protocol handler for an 'md5' URI scheme. Md5 URLs look like this: md5:deadbeefdeadbeefdeadbeefdeadbeef When this handler is invoked against an md5 URL, it passes the raw md5 to the configured script as an argument. The configured script then does the work to bring the item pointed to by the md5 local so we can open a Stream on the local copy. Local file is deleted when we finish. Do DownloadURLConnection.getFile() to get name of temporary file.

You need to define the system property -Djava.protocol.handler.pkgs=org.archive.net to add this handler to the java.net.URL set. Also define system properties -Dorg.archive.net.md5.Md5URLConnection.path=PATH_TO_SCRIPT to pass path of script to run as well as -Dorg.archive.net.md5.Md5URLConnection.options=OPTIONS for any options you'd like to include. The pointed-to PATH_TO_SCRIPT will be invoked as follows: PATH_TO_SCRIPT OPTIONS MD5 LOCAL_TMP_FILE. The LOCAL_TMP_FILE file is made in java.io.tmpdir using java tmp name code.

Author:
stack