Hi Sergey, Thanks a lot for your reply.
CXF ResourceComparator sounds quite interesting and I think it could be quite helpful from time to time. But pointing me to FIQL search queries was even of more value to me. I think FIQL search queries will help me best with my current use-case. Best regards. Jan From: Sergey Beryozkin-5 [via CXF] [mailto:[email protected]] Sent: Mittwoch, 31. Oktober 2012 17:19 To: Jan Bernhardt Subject: Re: JAX-RS Method overloading? Hi On 31/10/12 15:04, janb wrote: > Hi all, > > is it possible with CXF to have two (or more) methods in a single class that > share the same REST URL (@Path annotation) and also the same HTTP Operation > (e.g. @POST) and only differ in Type of a method parameter? > > Example: > > @Path("user") > public class UserController { > > @POST > @Path("/search") > public List<User> searchUser(SearchType complexSearch) { > . . . > } > > @POST > @Path("/search") > public List<User> searchUser(AnotherSearchType anotherSearch) { > . . . > } > > . . . > } > No, this option is not supported in JAX-RS. I think there could be few options to get this limitation bypassed: - Have a single method accepting JAXP Source - assuming it is XML - Consider introducing a catch-all MultivaluedMap or query bean, assuming it is a form payload, or may be queries. I guess it also makes sense to use @GET for searching. Can you provide some more context please ? Actually, a CXF specific extension may help, called ResourceComparator. You can use it to help the runtime to choose between two equal candidates, such as the two methods above. It can work if the request URI or some headers can provide the extra context, which can help with figuring out if it is SearchType or AnotherSearchType that is 'coming in' You may also want to have a look at http://cxf.apache.org/docs/jax-rs-advanced-features.html#JAX-RSAdvancedFeatures-FIQLsearchqueries, may be for the future ref, this is what I'm prioritizing upon... HTH, Sergey > > > -- > View this message in context: > http://cxf.547215.n5.nabble.com/JAX-RS-Method-overloading-tp5717638.html > Sent from the cxf-user mailing list archive at Nabble.com. -- Sergey Beryozkin Talend Community Coders http://coders.talend.com/ Blog: http://sberyozkin.blogspot.com ________________________________ If you reply to this email, your message will be added to the discussion below: http://cxf.547215.n5.nabble.com/JAX-RS-Method-overloading-tp5717638p5717643.html To unsubscribe from JAX-RS Method overloading?, click here<http://cxf.547215.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5717638&code=amJlcm5oYXJkdEB0YWxlbmQuY29tfDU3MTc2Mzh8LTEzMDQ4ODk1MjM=>. NAML<http://cxf.547215.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> -- View this message in context: http://cxf.547215.n5.nabble.com/JAX-RS-Method-overloading-tp5717638p5718482.html Sent from the cxf-user mailing list archive at Nabble.com.
