Incorrect content type in JsonService
|Reported by:||anonymous||Owned by:||alex|
I used JsonService but I got an empty input stream in my servlet. I used TCP monitor to see what's happening, I found that the content type was incorrect.
Here is the capture of TCP monitor:
POST /lnp/resources/pages/Test.page?service=jsonrpc HTTP/1.1
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:22.214.171.124) Gecko/20060111 Firefox/126.96.36.199
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q= 0.7
I also found the root cause of this problem. The mimetype is not recognized by dojo.io.XMLHTTPTransport.
I change one line to get it work for me, but it may not be good enough for dojo project. My change is in BrowserIO.js;
The original line is:
http.setRequestHeader("Content-Type", kwArgs.multipart ? ("multipart/form-data; boundary=" + this.multipartBoundary) : (kwArgs.contentType | | "application/x-www-form-urlencoded"));
My new line is:
http.setRequestHeader("Content-Type", kwArgs.multipart ? ("multipart/form-data; boundary=" + this.multipartBoundary) : (kwArgs.contentType | | kwArgs.mimetype | | "application/x-www-form-urlencoded"));
if the core developers can review dojo code and use a consistent name for "contentType" or "mimetype".
Change History (3)
comment:1 Changed 8 years ago by alex
- Milestone changed from 0.2.2release to 0.3release
- Owner changed from anonymous to alex
- Priority changed from highest to high
- severity changed from blocker to major
- Status changed from new to assigned
comment:2 Changed 8 years ago by sjmiles
- Resolution set to wontfix
- Status changed from assigned to closed