Hi,
I'm having a faulty Content-Type request header built under Chrome when I issue an updateData() on
my data source. Everything works fine under FireFox. My updateData() relies on the PUT HTTP method.
The problem is that the Content-Type request header contains "text/xml, application/json" instead
of simply "application/json" as defined in my data source. I checked the request headers under Chrome
and FireFox (using FireBug) and they indeed don't get produced the same way...
This makes my Spring MVC java backend produce an HTTP 500 error with the following stack trace :
Here's the relevant part of my data source definition:
Any idea why this is happening ? Any way to fix this ?
Thanks,
I'm having a faulty Content-Type request header built under Chrome when I issue an updateData() on
my data source. Everything works fine under FireFox. My updateData() relies on the PUT HTTP method.
The problem is that the Content-Type request header contains "text/xml, application/json" instead
of simply "application/json" as defined in my data source. I checked the request headers under Chrome
and FireFox (using FireBug) and they indeed don't get produced the same way...
This makes my Spring MVC java backend produce an HTTP 500 error with the following stack trace :
Code:
2011-11-13 10:27:40,433 (http-8080-4) ERROR [com.meicpg.ti.web.exceptions.ExceptionResource] - java.lang.IllegalArgumentException: Invalid token character ',' in token "xml, application/json" at org.springframework.http.MediaType.checkToken(MediaType.java:282) at org.springframework.http.MediaType.<init>(MediaType.java:255) at org.springframework.http.MediaType.parseMediaType(MediaType.java:584) at org.springframework.http.HttpHeaders.getContentType(HttpHeaders.java:286) at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.readWithMessageConverters(HandlerMethodInvoker.java:612) at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.resolveRequestBody(HandlerMethodInvoker.java:597) at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.resolveHandlerArguments(HandlerMethodInvoker.java:346) at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:171) at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:426) at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:414) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644) at org.springframework.web.servlet.FrameworkServlet.doPut(FrameworkServlet.java:571) ...
Code:
MyDataSource.addProperties ({ dataFormat : 'json', ... operationBindings : [ { operationType : 'fetch', dataProtocol : 'getParams', dataFormat : 'json', requestProperties : { httpMethod : 'GET', httpHeaders : { 'Accept' : 'application/json', 'Content-Type' : 'application/json' } } }, { operationType : 'update', dataProtocol : 'postMessage', dataFormat : 'json', requestProperties : { httpMethod : 'PUT', httpHeaders : { 'Accept' : 'application/json', 'Content-Type' : 'application/json' } } } ], ...
Thanks,
Comment