public static String encodeCookie ( String string ) { if ( string == null ) { return null ; } string = string . replaceAll ( "%" , "%25" ) ; string = string . replaceAll ( ";" , "%3B" ) ; string = string . replaceAll ( "," , "%2C" ) ; return string ; }
Encodes the given string so that it can be used as an HTTP cookie value .