public String getUserAgent ( FacesContext facesContext ) { if ( userAgent == null ) { synchronized ( this ) { if ( userAgent == null ) { Map < String , String [ ] > requestHeaders = facesContext . getExternalContext ( ) . getRequestHeaderValuesMap ( ) ; if ( requestHeaders != null && requestHeaders . containsKey ( "User-Agent" ) ) { String [ ] userAgents = requestHeaders . get ( "User-Agent" ) ; userAgent = userAgents . length > 0 ? userAgents [ 0 ] : null ; } } } } return userAgent ; }
This information will get stored as it cannot change during the session anyway .