Class BasicURLCanonicalizer
java.lang.Object
org.archive.url.BasicURLCanonicalizer
- All Implemented Interfaces:
URLCanonicalizer
Canonicalizer that does more or less basic fixup. Based initially on rules
specified at https://developers.google.com/safe-browsing/developers_guide_v2#
Canonicalization. These rules are designed for clients of Google's
"experimental" Safe Browsing API to "check URLs against Google's
constantly-updated blacklists of suspected phishing and malware pages".
This class differs from Google in treatment of non-ascii input. Google's rules don't really address this except with one example test case, which seems to suggest taking raw input bytes and pct-encoding them byte for byte. Since the input to this class consists of java strings, not raw bytes, that wouldn't be possible, even if deemed preferable. Instead, BasicURLCanonicalizer expresses non-ascii characters pct-encoded UTF-8.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionattemptIPFormats(String host) voidcanonicalize(HandyURL url) escapeOnce(String input) intgetHex(int b) minimalEscape(String input) normalizePath(String path) unescapeRepeatedly(String input) protected static CharsetUTF8()
-
Field Details
-
_UTF8
-
-
Constructor Details
-
BasicURLCanonicalizer
public BasicURLCanonicalizer()
-
-
Method Details
-
canonicalize
- Specified by:
canonicalizein interfaceURLCanonicalizer
-
normalizePath
-
attemptIPFormats
-
minimalEscape
-
UTF8
-
escapeOnce
-
unescapeRepeatedly
-
decode
-
getHex
public int getHex(int b)
-