public static void parseUserInfo(String userInfo, 
            GuacamoleConfiguration config)
            throws UnsupportedEncodingException {

        Matcher userinfoMatcher = userinfoPattern.matcher(userInfo);

        if (userinfoMatcher.matches()) {
            String username = userinfoMatcher.group(USERNAME_GROUP);
            String password = userinfoMatcher.group(PASSWORD_GROUP);

            if (username != null && !username.isEmpty())
                config.setParameter("username",
                        URLDecoder.decode(username, "UTF-8"));

            if (password != null && !password.isEmpty())
                config.setParameter("password",
                        URLDecoder.decode(password, "UTF-8"));
        }

    }
public static void parseUserInfo ( String userInfo , GuacamoleConfiguration config ) throws UnsupportedEncodingException { Matcher userinfoMatcher = userinfoPattern . matcher ( userInfo ) ; if ( userinfoMatcher . matches ( ) ) { String username = userinfoMatcher . group ( USERNAME_GROUP ) ; String password = userinfoMatcher . group ( PASSWORD_GROUP ) ; if ( username != null && ! username . isEmpty ( ) ) config . setParameter ( "username" , URLDecoder . decode ( username , "UTF-8" ) ) ; if ( password != null && ! password . isEmpty ( ) ) config . setParameter ( "password" , URLDecoder . decode ( password , "UTF-8" ) ) ; } }
Parse the given string for username and password values,
and, if values are present, decode them and set them in
the provided GuacamoleConfiguration object.

@param userInfo
The string to parse for username/password values.

@param config
The GuacamoleConfiguration object to store the username
and password in.

@throws UnsupportedEncodingException
If Java lacks UTF-8 support.