Stacktrace is listed below. Really could not figure out what it means. Thanks for any help.
Caused by: java.lang.IllegalArgumentException: Invalid token character ':' in token "Accept:text"
at org.springframework.http.MediaType.checkToken(MediaType.java:282) ~[spring-web-3.0.5.RELEASE.jar:3.0.5.RELEASE]
at org.springframework.http.MediaType.<init>(MediaType.java:254) ~[spring-web-3.0.5.RELEASE.jar:3.0.5.RELEASE]
at org.springframework.http.MediaType.parseMediaType(MediaType.java:584) ~[spring-web-3.0.5.RELEASE.jar:3.0.5.RELEASE]
at org.springframework.http.MediaType.parseMediaTypes(MediaType.java:602) ~[spring-web-3.0.5.RELEASE.jar:3.0.5.RELEASE]
at org.springframework.web.servlet.view.ContentNegotiatingViewResolver.getMediaTypes(ContentNegotiatingViewResolver.java:306) ~[spring-webmvc-3.0.5.RELEASE.jar:3.0.5.RELEASE]
at org.springframework.web.servlet.view.ContentNegotiatingViewResolver.resolveViewName(ContentNegotiatingViewResolver.java:366) ~[spring-webmvc-3.0.5.RELEASE.jar:3.0.5.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.resolveViewName(DispatcherServlet.java:1078) ~[spring-webmvc-3.0.5.RELEASE.jar:3.0.5.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1027) ~[spring-webmvc-3.0.5.RELEASE.jar:3.0.5.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:开发者_Go百科817) ~[spring-webmvc-3.0.5.RELEASE.jar:3.0.5.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719) ~[spring-webmvc-3.0.5.RELEASE.jar:3.0.5.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644) ~[spring-webmvc-3.0.5.RELEASE.jar:3.0.5.RELEASE]
... 53 common frames omitted
This exception mean that you have incorrect mediaType format. the correct media type is "application/json", "text/html", "image/png";
I just looked at the the source code of org.springframework.http.MediaType
and these are correct separators for MediaType.
BitSet separators = new BitSet(128);
separators.set('(');
separators.set(')');
separators.set('<');
separators.set('>');
separators.set('@');
separators.set(',');
separators.set(';');
separators.set(':');
separators.set('\\');
separators.set('\"');
separators.set('/');
separators.set('[');
separators.set(']');
separators.set('?');
separators.set('=');
separators.set('{');
separators.set('}');
separators.set(' ');
separators.set('\t');
':'
is not defined there and this is the reason why does this exception is thrown, now this is your turn to find out why do you have Accept HTTP Header parameter instead of correct media Type ("application/json", "image/jpg", "application/octec-stream", etc...).
Hope it helps.
精彩评论