cookie报错 :服务器异常An invalid character [32] was present in the Cookie value

String KaptchaOwner= CommunityUtil.generateUUID();
Cookie cookie=new Cookie("kaptchaOwner",KaptchaOwner);
response.addCookie(cookie);
错误原因是在于cookie中不能存在非法字符,比如空格,而uuid生成的字符会产生空格导致cookie错误
posted @ 2023-03-01 20:49  B站读研  阅读(65)  评论(0)    收藏  举报