HTTP Status 500 - Request processing failed; …

2018-06-18 02:04:35来源:未知 阅读 ()

新老客户大回馈,云服务器低至5折

 1 HTTP Status 500 - Request processing failed; nested exception is java.lang.IllegalArgumentException: Control character in cookie value or attribute.
 2 type Exception report
 3 
 4 message Request processing failed; nested exception is java.lang.IllegalArgumentException: Control character in cookie value or attribute.
 5 
 6 description The server encountered an internal error that prevented it from fulfilling this request.
 7 
 8 exception
 9 
10 org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.IllegalArgumentException: Control character in cookie value or attribute.
11     org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:982)
12     org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)
13     javax.servlet.http.HttpServlet.service(HttpServlet.java:650)
14     org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
15     javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
16     org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
17     org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)
18     org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
19 root cause
20 
21 java.lang.IllegalArgumentException: Control character in cookie value or attribute.
22     org.apache.tomcat.util.http.CookieSupport.isHttpSeparator(CookieSupport.java:205)
23     org.apache.tomcat.util.http.CookieSupport.isHttpToken(CookieSupport.java:229)
24     org.apache.tomcat.util.http.ServerCookie.appendCookieValue(ServerCookie.java:185)
25     org.apache.catalina.connector.Response.generateCookieString(Response.java:1054)
26     org.apache.catalina.connector.Response.addCookie(Response.java:996)
27     org.apache.catalina.connector.ResponseFacade.addCookie(ResponseFacade.java:380)
28     admin.membersheep.hk.Controller.HomeController.Login(HomeController.java:327)
29     sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
30     sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
31     sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
32     java.lang.reflect.Method.invoke(Method.java:498)
33     org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:220)
34     org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:134)
35     org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:116)
36     org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)
37     org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)
38     org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
39     org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963)
40     org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897)
41     org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
42     org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)
43     javax.servlet.http.HttpServlet.service(HttpServlet.java:650)
44     org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
45     javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
46     org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
47     org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)
48     org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
49 note The full stack trace of the root cause is available in the Apache Tomcat/7.0.85 logs.

 IllegalArgumentException此异常表明向方法传递了一个不合法或不正确的参数

注意Control character in cookie value or attribute 这个才是重点

问题说明Cookie编码格式错误

解决办法cookie存储值是指明utf8国际编码格式

javax.servlet.http.Cookie realCookie = new javax.servlet.http.Cookie(java.net.URLEncoder.encode(temp.getName(),"utf8"),java.net.URLEncoder.encode(temp.getValue(),"utf8"));

  未经同意请勿转载!!!

 

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:巨人大哥谈Java禁止浏览器有缓存的源码

下一篇:javaee 学习(一)