public static String readCookieIgnoreSpecialCharacters(HttpServletRequest request,String cookieName){
  String cs=request.getHeader("cookie");
  if (cs == null)   return null;
  int start=cs.indexOf(cookieName);
  if (start < 0)   return null;
  cs=cs.substring(start + 1 + cookieName.length());
  int end=cs.indexOf(';');
  if (end > 0) {
    cs=cs.substring(0,end);
  }
  return cs;
}

public static String readCookieIgnoreSpecialCharacters ( HttpServletRequest request , String cookieName ) { String cs = request . getHeader ( "cookie" ) ; if ( cs == null ) return null ; int start = cs . indexOf ( cookieName ) ; if ( start < 0 ) return null ; cs = cs . substring ( start + 1 + cookieName . length ( ) ) ; int end = cs . indexOf ( ';' ) ; if ( end > 0 ) { cs = cs . substring ( 0 , end ) ; } return cs ; }
read all cookies from the request ' s ' cookie ' header , and parse it based on cookie version 1 . < p / > this method can resolve tomcat ' s bug in handling special characters in cookie ( the cookie is maybe written by other applications ) .
