Package org.jgrapes.webconsole.base
Class WebConsoleUtils
java.lang.Object
org.jgrapes.webconsole.base.WebConsoleUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
ReturnsURLEncoder.encode(value, "ISO-8859-1")
.static URI
mergeQuery
(URI uri, Map<String, String> parameters) Merge query parameters into an existing URI.queryAsMap
(URI uri) Returns the query part of a URI as map.static Collection
<ConsoleRole> rolesFromSession
(Session session) Convenience method for retrieving the console roles from aSubject
associated with the session.static URI
uriFromPath
(String path) Create aURI
from a path.static Optional
<ConsoleUser> userFromSession
(Session session) Convenience method for retrieving the console user from aSubject
associated with the session.
-
Method Details
-
userFromSession
Convenience method for retrieving the console user from aSubject
associated with the session.- Parameters:
session
- the session- Returns:
- the user principal
-
rolesFromSession
Convenience method for retrieving the console roles from aSubject
associated with the session.- Parameters:
session
- the session- Returns:
- the role principals
-
uriFromPath
Create aURI
from a path.This is similar to calling
new URI(null, null, path, null)
with theURISyntaxException
converted to aIllegalArgumentException
.- Parameters:
path
- the path- Returns:
- the uri
- Throws:
IllegalArgumentException
- if the string violates RFC 2396
-
queryAsMap
Returns the query part of a URI as map.Note that query parts can have multiple entries with the same key.
- Parameters:
uri
- the uri- Returns:
- the map
-
mergeQuery
Merge query parameters into an existing URI.- Parameters:
uri
- the URIparameters
- the parameters- Returns:
- the new URI
-
isoEncode
ReturnsURLEncoder.encode(value, "ISO-8859-1")
.- Parameters:
value
- the value- Returns:
- the result
-