code: public static UserAgent getUserAgent(HttpServletRequest request) {
          if (request == null) {
              return null;
          }
          String userAgentHead = request.getHeader("User-Agent");
          return getUserAgent(userAgentHead);
      }
docs: get user agent