Package org.cyclos.utils
Class URIHelper
- java.lang.Object
-
- org.cyclos.utils.URIHelper
-
public class URIHelper extends Object
Helper class for URIs
-
-
Constructor Summary
Constructors Constructor Description URIHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringgetDomain(URI uri)Returns the domain, which is the scheme and host.static StringgetOrigin(URI uri)Returns the "JavaScript origin" from the given URI, that means: scheme, host and port.static booleaninSameOrigin(Stream<String> uris)Indicates whether all the non-null uris in the given stream belong to the same domainstatic URIof(String uri)Same as creating an URI from the given string, but returning null if invalid instead of throwing anURISyntaxException.
-
-
-
Method Detail
-
getDomain
public static String getDomain(URI uri)
Returns the domain, which is the scheme and host. Differs fromgetOrigin(URI)in the sense that doesn't force the default ports
-
getOrigin
public static String getOrigin(URI uri)
Returns the "JavaScript origin" from the given URI, that means: scheme, host and port. Basically, ignores the path and query parameters
-
inSameOrigin
public static boolean inSameOrigin(Stream<String> uris)
Indicates whether all the non-null uris in the given stream belong to the same domain
-
of
public static URI of(String uri)
Same as creating an URI from the given string, but returning null if invalid instead of throwing anURISyntaxException.
-
-