Package crawlercommons.utils
Class URLUtils
- java.lang.Object
-
- crawlercommons.utils.URLUtils
-
public class URLUtils extends Object
-
-
Constructor Summary
Constructors Constructor Description URLUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static URLresolve(URL base, String spec)Resolves a URL against a base URL.
-
-
-
Method Detail
-
resolve
public static URL resolve(URL base, String spec) throws MalformedURLException
Resolves a URL against a base URL.Context: this helper was introduced when migrating callers from using
java.net.URLconstructors toURI. The rawURI.resolvesemantics differ in a few corner cases fromURL-based resolution did. To avoid scattering ad-hoc fixes across the codebase, the normalization logic lives here so resolution behavior is consistent and easier to maintain.- Parameters:
base- the base URLspec- the URL specification to resolve- Returns:
- the resolved URL
- Throws:
MalformedURLException- if the URL cannot be resolved
-
-