Details
Description
Initial description:
Jettison provides a configuration option to omit the '@' from attributes:
org.codehaus.jettison.mapped.Configuration.setSupressAtAttributes(boolean)
see Jettison Jira:
http://jira.codehaus.org/browse/JETTISON-2
org.apache.cxf.jaxrs.provider.JSONProvider should also expose this property.
--------------------------------------------------------------------------------
My additional comments:
I think the original issue is not fixed.
There is a solution by subclassing the JSONProvider like Sergey Beryozkin said
"
Sergey Beryozkin added a comment - 03/May/11 14:05
What you may want to do is to register a custom JSONProvider provider which overrides its createWriter method (copy the code from the parent method and set suppressAtAttributes property on Configuration). May be it will help ?
"
But in reality we can't override the createWriter method just do add the simple line:
config.setSupressAtAttributes(true); //MODIFIED
Because the original createWriter method is using a lot of private attributes in the original class, which are not accessible in the subclass, even by a getter.
The only solution i had was to copy the original class and add a single line.
It is not for many reasons like: if i update my CXF lib version, i will have to report the JSONProvider updates in my copy, or keep my outdated copy.
I think a boolean setter should be set in the org.apache.cxf.jaxrs.provider.JSONProvider so that we can tell to JSONProvider if we want to use the config.setSupressAtAttributes(true).
Thanks
Attachments
Issue Links
- is a clone of
-
CXF-3483 JSONProvider: Don't force attributes to have @ if users doesn't want them too
- Closed