public static URI getUserURI ( final String sessionUserId ) { // user id could be in format <anonymous>, remove < at the beginning and the > at the end in this case. final String userId = ( sessionUserId == null ? "anonymous" : sessionUserId ) . replaceAll ( "^<|>$" , "" ) ; try { final URI uri = URI . create ( userId ) ; // return useId if it's an absolute URI or an opaque URI if ( uri . isAbsolute ( ) || uri . isOpaque ( ) ) { return uri ; } else { return buildDefaultURI ( userId ) ; } } catch ( final IllegalArgumentException e ) { return buildDefaultURI ( userId ) ; } }
Returns the user agent based on the session user id .