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)");
    }
  }
相关推荐
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页