java判断IOS还是安卓,跳转不同的连接

 protected void doGet(HttpServletRequest request, HttpServletResponse response, boolean headOnly) throws Exception
  {
    if (log.isLoggable(Level.FINER))
    {
      log.entering(DownloadHandler.class.getName(), "doGet(HttpServletRequest request, HttpServletResponse response, boolean headOnly)",
          new Object[] { request, response, headOnly });
    }
    Enumeration names = request.getHeaderNames();
    String url = "";
    while (names.hasMoreElements())
    {
      String name = (String) names.nextElement();
      if (request.getHeader(name).contains("iPhone"))
      {
        url = "http://baidu.com";
        break;
      }
    }
    if ("".equals(url))
    {
      url = "http://t.cn/RARuhaS";
    }
    response.sendRedirect(url);

    if (log.isLoggable(Level.FINER))
    {
      log.exiting(DownloadHandler.class.getName(), "doGet(HttpServletRequest request, HttpServletResponse response, boolean headOnly)");
    }
  }

你可能感兴趣的:(java)