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 StringgetNonEmptyPath(MutableUri uri)Returns / when the givenurihas no path component, returns the uri path otherwise.static intgetPort(String scheme, int port)Returns the default's protocol port if not set in the given URIscheme, the URI port otherwise.static booleanisSecure(String scheme)Returnstrueif the given URI scheme is for a secure (TLS) connection.
-
-
-
Method Detail
-
isSecure
public static boolean isSecure(String scheme)
Returnstrueif the given URI scheme is for a secure (TLS) connection.- Parameters:
scheme- URI scheme- Returns:
trueif the given URI scheme is for a secure (TLS) connection.
-
getNonEmptyPath
public static String getNonEmptyPath(MutableUri uri)
Returns / when the givenurihas 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.
-
-