Hi
On 07/11/14 03:42, Jochen Szostek wrote:
Hi all,
I was hoping to integrate Apache CXF - JAX-RS Search with my RestEasy app.
I tried numerous things...but in the end I always get an:
Unable to find contextual data of type:
org.apache.cxf.jaxrs.ext.search.SearchContext
when trying to access/use the SearchContext (e.g.
searchContext.getCondition(Fake.class);)
Does anyone know of a possible / sensible way of integrating the two?
Perhaps the simplest option to start is to create SearchContextImpl
directly in the code (this can be neatly hidden later on into some
helper utility class):
@GET
public Response findIt(@QueryParam("_s") String searchExpression) {
// we need to explicitly use an '_s' parameter in this case if the
search query is passed as a query;
SearchContext ctx = getSearchContext();
cxt.getSearchCondition(searchExpression, Fake.class);
}
private SearchContext getSearchContext() {
Message m = new MessageImpl();
// some properties can be set on the message but an empty message
can work too
return new SearchContextImpl(m);
}
Give it a try please
HTH, Sergey
Thanks a lot in advance,
Jochen
ps: stackoverflow link:
http://stackoverflow.com/questions/26793634/apache-cxf-jax-rs-search-integration-with-resteasy