Hi

I have build a rest WS with CXF and what it does is fetching data from a
database and returns a list of POJO objects e.g. List<Book> 

@XmlRootElement
public Book{
       String title;
       String author;

getters and setters...
}

Currently I have used the extentionMapping to get my result in json, jsonp
and xml. In order to get the .jsonp I have over-ridden the writeTo of the
org.apache.cxf.jaxrs.provider.json.JSONProvider

<jaxrs:extensionMappings>
        <entry key="json" value="application/json" />
        <entry key="xml" value="application/xml" />
        <entry key="jsonp" value="application/javascript" />
</jaxrs:extensionMappings>

So lets say that in my List<Book> that I return in my with the  
Response.status(Status.OK).entity(new GenericEntity<List&lt;Book>>(books)
{}).build();

the author in some of the Book objects is null then in the response the
fields that was null will not be displayed. I know that if I set the
(nillable="true") in my Book then I will get the null fields in my response. 

Is there any way to give to the user the option (with a query parameter
?returnNull=true) to set if he wants to get the null values back or not? 

Thanks



--
View this message in context: 
http://cxf.547215.n5.nabble.com/How-to-dynamically-show-and-hide-the-null-values-of-a-response-tp5732099.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to