Closed jerseyrobot closed 10 years ago
@glassfishrobot Commented Reported by forchel
@glassfishrobot Commented mfuksa said: Hi, thank you for the bug report. I am moving the issue to the backlog.
Mira
proposal for fix: simple fix could be to wrap the outputStream in JsonStructureBodyWriter and do not propagate the close method. Another option is to pass already wrapper output stream to MBWs so that no MBW can close the stream. The second option looks better for me.
@glassfishrobot Commented Was assigned to michalgajdos
@glassfishrobot Commented This issue was imported from java.net JIRA JERSEY-2533
@glassfishrobot Commented Marked as fixed on Friday, June 27th 2014, 5:24:38 am
I'm using Jersey 2.8 to generate JSONP with JsonStructur (super type for the two structured types in JSON JsonObject and JsonArray) as return type. Unfortunately the generated JSONP is syntactically incorrect as the closing parenthese is missing, e.g.
is returned. I've modified and tested the example given by Jersey (see examples/json-processing-webapp) and it the JUnit test fails with the following exception:
It seems, that the used JsonStructureBodyWriter closes the Outputstream and the JsonWithPaddingInterceptor is not able to write the closing parenthese to the commiting OutputStream. To test this by yourself you can modify the ChangeListResource class from the mentioned example with this additional method:
And the JsonWithPaddingTest class with this test method:
Environment
Linux, Windows, Apache, Tomcat 7
Affected Versions
[2.8]