Jason, The simplest thing to do is simply set only the fields in your bean that the client is interested in, since null fields are ignored by JAXB. I do this programatically via a simple switch statement, where each case calls the proper setter for the field the user is interested in (for instance in a class which converts a ResultSet or a SolrDocument into your bean).
Mike On Wed, Apr 28, 2010 at 6:58 PM, KARR, DAVID (ATTSI) <[email protected]> wrote: > > -----Original Message----- > > From: Jason Chaffee [mailto:[email protected]] > > Sent: Wednesday, April 28, 2010 2:45 PM > > To: [email protected] > > Subject: filtering elements in jaxrs > > > > I would like the consumer of my API to be able witch fields (elements) > > they actually want returned in an effort to keep the content as small > > as > > possible, similar to what Solr allows in search. What is the best way > > to accomplish this with JAX-RS and CXF? > > When you get down to it, you have to have some way in your service > interface for the client to specify they want this alternate response. > There are numerous ways to do it, either through the request path, or > through additional request parameters. You just have to decide what's > the most convenient strategy between you and the client. There is no > magic here. >
