Class WebConsoleUtils

java.lang.Object
org.jgrapes.webconsole.base.WebConsoleUtils

public final class WebConsoleUtils extends Object
  • Method Details

    • userFromSession

      public static Optional<ConsoleUser> userFromSession(org.jgrapes.http.Session session)
      Convenience method for retrieving the console user from a Subject associated with the session.
      Parameters:
      session - the session
      Returns:
      the user principal
    • rolesFromSession

      public static Collection<ConsoleRole> rolesFromSession(org.jgrapes.http.Session session)
      Convenience method for retrieving the console roles from a Subject associated with the session.
      Parameters:
      session - the session
      Returns:
      the role principals
    • uriFromPath

      public static URI uriFromPath(String path) throws IllegalArgumentException
      Create a URI from a path.

      This is similar to calling new URI(null, null, path, null) with the URISyntaxException converted to a IllegalArgumentException.

      Parameters:
      path - the path
      Returns:
      the uri
      Throws:
      IllegalArgumentException - if the string violates RFC 2396
    • queryAsMap

      public static Map<String,List<String>> queryAsMap(URI uri)
      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

      public static URI mergeQuery(URI uri, Map<String,String> parameters)
      Merge query parameters into an existing URI.
      Parameters:
      uri - the URI
      parameters - the parameters
      Returns:
      the new URI
    • isoEncode

      public static String isoEncode(String value)
      Returns URLEncoder.encode(value, "ISO-8859-1").
      Parameters:
      value - the value
      Returns:
      the result