Package org.jgrapes.webconsole.base
Class WebConsoleUtils
java.lang.Object
org.jgrapes.webconsole.base.WebConsoleUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringReturnsURLEncoder.encode(value, "ISO-8859-1").static URImergeQuery(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 aSubjectassociated with the session.static URIuriFromPath(String path) Create aURIfrom a path.static Optional<ConsoleUser> userFromSession(Session session) Convenience method for retrieving the console user from aSubjectassociated with the session.
-
Method Details
-
userFromSession
Convenience method for retrieving the console user from aSubjectassociated with the session.- Parameters:
session- the session- Returns:
- the user principal
-
rolesFromSession
Convenience method for retrieving the console roles from aSubjectassociated with the session.- Parameters:
session- the session- Returns:
- the role principals
-
uriFromPath
Create aURIfrom a path.This is similar to calling
new URI(null, null, path, null)with theURISyntaxExceptionconverted 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
-