code: 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;
      }
docs: This information will get stored as it cannot
  change during the session anyway.
  @return the UserAgent of the request.