org.erowid.sperowider
Class PatternMatchingHandler
java.lang.Object
org.erowid.sperowider.AHandler
org.erowid.sperowider.PatternMatchingHandler
- public class PatternMatchingHandler
- extends AHandler
Uses the contents of a Sperowider custom tag inside of the passed in file to identify a
regex pattern as the mongling policy.
- Version:
- : $Header: /cvsroot/sperowider/SPEROWIDER_MODULE/javasource/org/erowid/sperowider/PatternMatchingHandler.java,v 1.7 2005/01/15 23:26:15 gurustu Exp $
- Author:
- : $Author: gurustu $
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PatternMatchingHandler
public PatternMatchingHandler()
download
public void download(HttpURLConnection connection,
String fileName,
String originalURL)
throws IOException
- Downloads a file via the passed in connection, and detects URLs using the Sperowider pattern
matching command embedded in the found file. That command would look like :
// <spero-mongle><pattern>"((/[^"]+)|(http://[^"]+))"</pattern><group>1</group><replace-with>SperoDocRoot + "includes/headers/" + "${URL}"</replace-with></spero-mongle>
- pattern indicates how to find URLs
- group is the number of the matching group in the pattern that has the URL
- replace-with is a pattern to use to replace the found URL. $0 through $9 can be used, as well
as {$url} to indicate the rectified form of the URL.
- Specified by:
download
in class AHandler
- Throws:
IOException
rectify
public void rectify(String filename)
throws IOException
- See
download(HttpURLConnection, String, String)
to see how URLs are rectified using
this handler.
- Specified by:
rectify
in class AHandler
- Throws:
IOException