Class GenericUrlNormalizer
- All Implemented Interfaces:
Configurable<GenericUrlNormalizerConfig>,WebUrlNormalizer
Generic implementation of WebUrlNormalizer that should satisfy
most URL normalization needs. This implementation relies on
UrlNormalizer. Please refer to it for complete documentation and
examples.
This class is in effect by default. To skip its usage, you
can explicitly set the URL Normalizer to null in the
WebCrawlerConfig.
By default, this class removes the URL fragment and applies these RFC 3986 normalizations:
- Converting the scheme and host to lower case
- Capitalizing letters in escape sequences
- Decoding percent-encoded unreserved characters
- Removing the default port
- Encoding non-URI characters
To overwrite this default, you have to specify a new list of normalizations
to apply, via the GenericUrlNormalizerConfig.setNormalizations(List)
method, or via XML configuration. Each
normalizations is identified by a code name. The following is the
complete code name list for supported normalizations. Click on any code
name to get a full description from WebUrlNormalizer:
addDirectoryTrailingSlash(since 2.6.0)addDomainTrailingSlash(since 2.6.1)addWWWdecodeUnreservedCharactersencodeNonURICharactersencodeSpaceslowerCase(since 2.9.0)lowerCasePath(since 2.9.0)lowerCaseQuery(since 2.9.0)lowerCaseQueryParameterNames(since 2.9.0)lowerCaseQueryParameterValues(since 2.9.0)lowerCaseSchemeHostremoveDefaultPortremoveDirectoryIndexremoveDotSegmentsremoveDuplicateSlashesremoveEmptyParametersremoveFragmentremoveQueryString(since 2.9.0)removeSessionIdsremoveTrailingFragment(since 3.1.0)removeTrailingQuestionMarkremoveTrailingSlash(since 2.6.0)removeTrailingHash(since 2.7.0)removeWWWreplaceIPWithDomainNamesecureSchemesortQueryParametersunsecureSchemeupperCaseEscapeSequence
In addition, this class allows you to specify any number of URL value replacements using regular expressions.
-
Field Summary
Fields inherited from interface com.norconex.commons.lang.config.Configurable
PROPERTY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanbooleaninthashCode()normalizeURL(String url) Normalize the given URL.toString()
-
Constructor Details
-
GenericUrlNormalizer
public GenericUrlNormalizer()
-
-
Method Details
-
normalizeURL
Description copied from interface:WebUrlNormalizerNormalize the given URL.- Specified by:
normalizeURLin interfaceWebUrlNormalizer- Parameters:
url- the URL to normalize- Returns:
- the normalized URL
-
equals
-
canEqual
-
hashCode
public int hashCode() -
toString
-
getConfiguration
- Specified by:
getConfigurationin interfaceConfigurable<GenericUrlNormalizerConfig>
-