Package org.forgerock.openig.websocket
Class UriUtils
- java.lang.Object
-
- org.forgerock.openig.websocket.UriUtils
-
public final class UriUtils extends Object
URI convenience methods.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
getNonEmptyPath(MutableUri uri)
Returns / when the givenuri
has no path component, returns the uri path otherwise.static int
getPort(String scheme, int port)
Returns the default's protocol port if not set in the given URIscheme
, the URI port otherwise.static boolean
isSecure(String scheme)
Returnstrue
if the given URI scheme is for a secure (TLS) connection.
-
-
-
Method Detail
-
isSecure
public static boolean isSecure(String scheme)
Returnstrue
if the given URI scheme is for a secure (TLS) connection.- Parameters:
scheme
- URI scheme- Returns:
true
if the given URI scheme is for a secure (TLS) connection.
-
getNonEmptyPath
public static String getNonEmptyPath(MutableUri uri)
Returns / when the givenuri
has no path component, returns the uri path otherwise.Convenient for HTTP layer when targeting server root
- Parameters:
uri
- request's uri- Returns:
- the raw path or "/" if it's null
-
getPort
public static int getPort(String scheme, int port)
Returns the default's protocol port if not set in the given URIscheme
, the URI port otherwise.- Parameters:
scheme
- URI schemeport
- port as returned by theURI
(can be -1 if unset)- Returns:
- the default's protocol port if not set in the given URI
scheme
, the URI port otherwise.
-
-