I first use browser to request. It can work. But not with ajax code and thorw an exception.
2018-01-05 16:25:14 ERROR [com.ndl.gm.controller.BaseController] Could not parse accept header [application/json, text/javascript, */*; q=0.01]: Invalid mime type " text/javascript": does not contain '/'
org.springframework.web.HttpMediaTypeNotAcceptableException: Could not parse accept header [application/json, text/javascript, */*; q=0.01]: Invalid mime type " text/javascript": does not contain '/'
at org.springframework.web.accept.HeaderContentNegotiationStrategy.resolveMediaTypes(HeaderContentNegotiationStrategy.java:54)
at
Here is my controller.
I solve my problem by trace the exception. Then i find the ' text/javascript'. It will be split to two mime. But the string ' ' don't contain '/'. So it goes wrong. The i would like to override the function in request getHeader, then i find i have been written the getHeader function to prevent xss attack. So, i just remove the code and it works.