Class SafeUrl
java.lang.Object
io.mindspice.simplypages.core.SafeUrl
Shared URL validation helpers for component attributes and inline CSS URL values.
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringBuilds a trusted CSSurl("...")value after validation.static voidValidates an image URL before embedding it inside a CSSurl(...)value.static voidvalidateHref(String url) Validates hyperlink-style URLs.
-
Method Details
-
validateHref
Validates hyperlink-style URLs.Allowed values are empty/null, fragment URLs, root/current/parent-relative URLs, protocol-relative URLs, query-only URLs, and absolute URLs with
http,https,mailto, ortelschemes.- Parameters:
url- URL value to validate- Throws:
IllegalArgumentException- when the URL uses a disallowed scheme
-
validateCssImageUrl
Validates an image URL before embedding it inside a CSSurl(...)value.This intentionally permits the same absolute/relative URL families as hyperlinks except
mailtoandtel. It also rejects CSS token delimiters that could break out of the generatedurl("...")value.- Parameters:
url- image URL- Throws:
IllegalArgumentException- when the URL cannot be safely embedded in CSS
-
cssUrl
-