Tanımlama bilgisi, cookie içerisindeki unicode değerini ayarlamaya çalışıyorum ancak bunu kabul etmiyor ve Exception özelliğini atar. Dizenin onaltılık değerini kontrol ettim ve doğru ama bir çerez eklerken Özel Durum atar.java.lang.IllegalArgumentException: Cookie değerinde veya niteliğinde kontrol karakteri
private void fnSetCookieValues(HttpServletRequest request,HttpServletResponse response)
{
Cookie[] cookies=request.getCookies();
for (int i = 0; i < cookies.length; i++) {
System.out.println(""+cookies.length+"Name"+cookies[i].getName());
if(cookies[i].getName().equals("DNString"))
{
System.out.println("Inside if:: "+cookies[i].getValue()+""+cookies.length);
try {
String strValue;
strValue = new String(request.getParameter("txtIIDN").getBytes("8859_1"),"UTF8");
System.out.println("Cookie Value To be stored"+strValue);
for (int j = 0; j < strValue.length(); j++) {
System.out.println("Code Point"+Integer.toHexString(strValue.codePointAt(j)));
}
Cookie ck = new Cookie("DNString",strValue);
response.addCookie(ck);
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
alıyorum:
java.lang.IllegalArgumentException: Control character in cookie value or attribute.
yanıt nesnesine çerez ekledi. Tomcat 7 ve Java 7'yi çalışma ortamı olarak kullanıyorum.
sayesinde !! –
Rica ederim. – BalusC