code: public boolean isValidUserAgent(final String agent) {
          if (!validateUserAgent) {
              return true;
          }
          final Matcher matcher = AGENT_PATTERN.matcher(agent);
          return matcher.matches();
      }
docs: Check whether the user agent is valid
  
  @param agent
  User-Agent
  @return True if the user agent is valid