Package org.eblocker.server.common.util
Class UrlUtils
java.lang.Object
org.eblocker.server.common.util.UrlUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringfindDomainInString(String url, boolean allowIpAddress) static StringfindUrlParameter(String requestUrl, String urlParam) static Stringstatic StringgetHostname(String urlString) static StringReturns only the origin of a given URLstatic booleanisInvalidDomain(String url) Checks whether the domain part of this url is a just a Top Level Domain (or invalid wildcard like '.'), which would be a big wildcard including lots of domains, and should therefore be forbidden to add.static booleanisSameDomain(String domain, String hostname) static booleanisUkStyleTdl(String hostname) static booleanstatic booleanstatic Stringstatic String
-
Constructor Details
-
UrlUtils
public UrlUtils()
-
-
Method Details
-
getHostname
-
isUkStyleTdl
-
getDomain
-
isUrl
-
isUrlWithoutProtocol
-
findUrlParameter
-
isSameDomain
-
isInvalidDomain
Checks whether the domain part of this url is a just a Top Level Domain (or invalid wildcard like '.'), which would be a big wildcard including lots of domains, and should therefore be forbidden to add. Domains may be given as bare domains (e.g. www.server.tld) but also as URLs as copy-pasted from the browsers address bar (e.g. https://user:pass@server.tld/folder/script.php?param=value¶m2=value2)- Parameters:
url- The URL to check- Returns:
- true if the URL contains a valid domain
-
findDomainInString
-
urlEncode
-
urlDecode
-
getOrigin
Returns only the origin of a given URL- Parameters:
url- full URL- Returns:
- origin of the URL, given by scheme, hostname and port (if specified)
-