Wednesday, May 13, 2009

CXF JAX-RS XPath provider

I think writing the code like this is great :


WebClient wc = WebClient.create(endpointAddress);
Book b =
wc.get(XMLSource.class).get("/*/book[@name='Bar']",
Book.class);


But may be sometimes you may just want

WebClient wc = WebClient.create(endpointAddress);
Book b = wc.get(Book.class);


and still be able to get to the Book named 'Bar' which is part of a larger document.

So a simple XPathProvider reader has been added to CXF, you can use it on either sides by registering it programmatically or from Spring. You can register a unique provider per class by adding an expression and class name pair, or you can have a single provider applying a single expression in all cases or per-class specific expression.

No comments: