Girish Subramanian
Girish Subramanian

Reputation: 81

Odata service hosted on Apache CXF

I am trying to evaluate on how to host an OData service in CXF. I am basically interested in getting the parse tree from $filter and use it to fetch data.

My service stack uses JPA, Hibernate, Spring and Oracle DB

Upvotes: 1

Views: 643

Answers (2)

Sergey Beryozkin
Sergey Beryozkin

Reputation: 848

See also http://java.dzone.com/articles/beyond-jax-rs-spec-apache-cxf where a CXF OData extension is described Cheers, Sergey

Upvotes: 1

Donal Fellows
Donal Fellows

Reputation: 137557

The $filter expression is a query parameter, therefore it maps to a method argument that has been annotated with @QueryParam (it can be very useful to specify a default value too, so that if the filter isn't supplied the method is still used):

@GET
@Path("{collection}")
@Produces("application/json")
public SomeResultType getCollection(
        @PathParam("collection") String collection,
        @QueryParam("$filter") @DefaultValue("") String filter) {
    // ... Do the filtered query here ...
}

Upvotes: 0

Related Questions