修改cas协议 https协议 改成http

写道
凉鞋与拖鞋的约会
edu.yale.its.tp.cas.util.SecureURL的 public static String retrieve(String url) throws IOException 类地换成
    public static String retrieve(String url) throws IOException {
        BufferedReader r = null;

        try {
        URL u = new URL(url);
        URLConnection uc = u.openConnection();
        uc.setRequestProperty("Connection", "close");
        r = new BufferedReader(new InputStreamReader(uc.getInputStream()));
        String line;
        StringBuffer buf = new StringBuffer();
        while ((line = r.readLine()) != null)
        buf.append(line + "\n");
        return buf.toString();
        } finally {
        try {
        if (r != null)
        r.close();
        } catch (IOException ex) {
        // ignore
        }
        }
        }


edu.yale.its.tp.cas.client.Uitil类
的public static String getService(HttpServletRequest request, String server)
      throws ServletException
修改为


  public static String getService(HttpServletRequest request, String server)
      throws ServletException {
    if (log.isTraceEnabled()){
    log.trace("entering getService(" + request + ", " + server + ")");
    }
     
    // ensure we have a server name
    if (server == null) {
    log.error("getService() argument \"server\" was illegally null.");
throw new IllegalArgumentException("name of server is required");
    }


    // now, construct our best guess at the string
    StringBuffer sb = new StringBuffer();
    if (request.isSecure())
      sb.append("https://");
    else
      sb.append("http://");
    sb.append(server);
    sb.append(request.getRequestURI());

    if (request.getQueryString() != null&&!"".equals(request.getQueryString())) {
      // first, see whether we've got a 'ticket' at all
      int ticketLoc = request.getQueryString().indexOf("ticket=");

      // if ticketLoc == 0, then it's the only parameter and we ignore
      // the whole query string

      // if no ticket is present, we use the query string wholesale
      if (ticketLoc == -1)
        sb.append("?" + request.getQueryString());
      else if (ticketLoc > 0) {
ticketLoc = request.getQueryString().indexOf("&ticket=");
if (ticketLoc == -1) {
  // there was a 'ticket=' unrelated to a parameter named 'ticket'
  sb.append("?" + request.getQueryString());
} else if (ticketLoc > 0) {
  // otherwise, we use the query string up to "&ticket="
          sb.append("?" + request.getQueryString().substring(0, ticketLoc));
}
      }
    }
    String encodedService = URLEncoder.encode(sb.toString());
    if (log.isTraceEnabled()){
    log.trace("returning from getService() with encoded service [" + encodedService + "]");
    }
    return encodedService;
  }

[url=http://tms.taoke.alimama.com/tms/topic.php?pid=mm_11452884_0_0&eventid=100806" target="_blank"]凉鞋与拖鞋的约会[/url]



你可能感兴趣的:(PHP,UP)