Hi,
I am new to Apache CXF and RESTFul web services,
I have written an Interceptor for transaction logging by implementing the
below interface and it works fine,
org.apache.cxf.jaxrs.ext.RequestHandler .
Issue is,
The request contains xml data and I have to get that xml data as a string.
I have implemented the org.apache.cxf.jaxrs.ext.RequestHandler interface
like below, but I am not able get the content. Please help me if there is
any way to get the xml as string from message object.
public Response handleRequest( Message message, ClassResourceInfo
classResouceInfo )
{
Set<Class<?>> contentFormats = message.getContentFormats();
if( contentFormats != null )
{
for( Class<?> contentFormat : contentFormats )
{
Object contentMessage = message.getContent(contentFormat);
if( contentMessage.toString().startsWith("<?xml") )
{
String content = contentMessage.toString();
}
}
}
}
Thanks,
Santhosh
--
View this message in context:
http://cxf.547215.n5.nabble.com/How-to-get-the-message-content-as-a-string-from-RequestHandler-tp5074552p5074552.html
Sent from the cxf-user mailing list archive at Nabble.com.