Javaでユーザーエージェントによる簡易ブラウザ判定

 public static String getBrowser(HttpServletRequest request) {

    String sUserAgent = request.getHeader("user-agent");

    if (isIE(sUserAgent)) {
      return BROWSER_IE;
    }
    if (isFirefox(sUserAgent)) {
      return BROWSER_FIREFOX;
    }
    if (isOpera(sUserAgent)) {
      return BROWSER_OPERA;
    }
    if (isChrome(sUserAgent)) {
      return BROWSER_CHROME;
    }
    if (isSafari(sUserAgent)) {
      return BROWSER_SAFARI;
    }
    if (isNetscape(sUserAgent)) {
      return BROWSER_NETSCAPE;
    }
    if (isiPhone(sUserAgent)) {
      return BROWSER_IPHONE;
    }
    if (isiPad(sUserAgent)) {
      return BROWSER_IPAD;
    }
    if (isiPod(sUserAgent)) {
      return BROWSER_IPOD;
    }
    if (isAndroid(sUserAgent)) {
      return BROWSER_ANDROID;
    }
    if (isWindowsPhone(sUserAgent)) {
      return BROWSER_WINDOWS_PHONE;
    }
    if (isBlackBerry(sUserAgent)) {
      return BROWSER_BLACKBERRY;
    }
    return BROWSER_UNKNOWN;
  }