Hi
It is not possible to control it at the JAX-RS filter level; you can for
XML, but using the CXF specific approach, unfortunately the idea of
managing the 'typed' entity streams at the filter level was not
supported, example, InputStream vs XMLStreamReader, etc.
So, add a basic custom XMLStreamReaderm, example,
import javax.xml.stream.XMLStreamReader;
import org.apache.cxf.staxutils.DepthXMLStreamReader;
public class CustomXmlStreamReader extends DepthXMLStreamReader {
public CustomXmlStreamReader(XMLStreamReader reader) {
super(reader);
}
}
and then extend JSONProvider and provide this implementation
Cheers, Sergey
On 22/04/14 12:42, Jose María Zaragoza wrote:
Hello:
I'm using CXF 2.7.8
I've created a REST service . Format for POST messages is JSON
Sometimes , the service receives null values
{ .... , ·"field": null , .....}
I want to develop a JAXRS filter to remove this fields.
So, I need to modify message . I would like to know if :
is there any JAXRS template to extract JSON fields and remove them dynamically ?
other choice?
something as Transformation Feature ?
Example Filter :
@Override
public Response handleRequest(Message message, ClassResourceInfo resourceClass)
{
@SuppressWarnings("unchecked")
MetadataMap<String, String> map = (MetadataMap<String, String>)
message.get("jaxrs.template.???????");
if(null != map)
{
for (Map.Entry<String, List<String>> entry: map.entrySet())
{
System.out.println("key:" + entry.getKey() + "- value:" +
entry.getValue());
}
}
return null;
}
Regards