You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by janb <jb...@talend.com> on 2012/11/15 08:52:17 UTC

RE: JAX-RS Method overloading?

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:ml-node+s547215n5717643h84@n5.nabble.com]
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.

Re: JAX-RS Method overloading?

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi Jan
On 20/11/12 16:04, janb wrote:
> Hi Sergey,
>
> looks great! Thanks for your work!
>
> My plan is to use FIQL queries within the Apache Syncope project for a couple of service interfaces (once CXF replaces Spring WS-Stack).
> I'm still struggling with a couple of other issues here, but as soon as I get the chance to test this new feature, I will let you know of the outcome.
>
Sounds good, thanks

> Have an great day!
You too,
Sergey

>
> Jan
>
> From: Sergey Beryozkin-5 [via CXF] [mailto:ml-node+s547215n5718844h15@n5.nabble.com]
> Sent: Dienstag, 20. November 2012 16:53
> To: Jan Bernhardt
> Subject: Re: JAX-RS Method overloading?
>
> On 20/11/12 15:43, Sergey Beryozkin wrote:
>
>> Hi,
>> On 15/11/12 13:58, Sergey Beryozkin wrote:
>>> Hi Jan
>>> On 15/11/12 07:52, janb wrote:
>>>> 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.
>>>
>>> I'm still doing some work on enhancing JPA2 converter, specifically, to
>>> do with the support for collections (and joins). IMHO, the search
>>> extension can become very useful once we get more coverage of various
>>> popular search technologies. LDAP plus most of the big data related dbs
>>> will be supported, etc
>>>
>> FYI, I've done some more work on enhancing JPA2 converter - I think it
>> is now quite functional/capable, please check the JPA2 section:
>>
>> https://cwiki.apache.org/confluence/display/CXF20DOC/JAX-RS+Advanced+Features#JAX-RSAdvancedFeatures-JPA2.0
>>
>>
>> and QueryContext has been introduced to make it simpler in to integrate
>> it all into the higher-level tooling and such:
>>
>> https://cwiki.apache.org/confluence/display/CXF20DOC/JAX-RS+Advanced+Features#JAX-RSAdvancedFeatures-JPA2.0
>
> sorry,
>
> https://cwiki.apache.org/confluence/display/CXF20DOC/JAX-RS+Advanced+Features#JAX-RSAdvancedFeatures-ConvertingFIQLquerieswithQueryContext
>
> Sergey
>
>>
>>
>> I'm going to test it on my end in our tooling project, but I'd
>> appreciate some feedback too
>>
>> Thanks, Sergey
>>
>>
>>> Cheers, Sergey
>>>
>>>>
>>>> Best regards.
>>>> Jan
>>>>
>>>> From: Sergey Beryozkin-5 [via CXF]
>>>> [mailto:[hidden email]</user/SendEmail.jtp?type=node&node=5718844&i=0>]
>>>> 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<
>>>>
>>>>
>>>> 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.
>>>
>>>
>>
>>
>
>
> ________________________________
> 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-tp5717638p5718844.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-tp5717638p5718845.html
> Sent from the cxf-user mailing list archive at Nabble.com.

RE: JAX-RS Method overloading?

Posted by janb <jb...@talend.com>.
Hi Sergey,

looks great! Thanks for your work!

My plan is to use FIQL queries within the Apache Syncope project for a couple of service interfaces (once CXF replaces Spring WS-Stack). I'm still struggling with a couple of other issues here, but as soon as I get the chance to test this new feature, I will let you know of the outcome.

Have an great day!

Jan

From: Sergey Beryozkin-5 [via CXF] [mailto:ml-node+s547215n5718844h15@n5.nabble.com]
Sent: Dienstag, 20. November 2012 16:53
To: Jan Bernhardt
Subject: Re: JAX-RS Method overloading?

On 20/11/12 15:43, Sergey Beryozkin wrote:

> Hi,
> On 15/11/12 13:58, Sergey Beryozkin wrote:
>> Hi Jan
>> On 15/11/12 07:52, janb wrote:
>>> 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.
>>
>> I'm still doing some work on enhancing JPA2 converter, specifically, to
>> do with the support for collections (and joins). IMHO, the search
>> extension can become very useful once we get more coverage of various
>> popular search technologies. LDAP plus most of the big data related dbs
>> will be supported, etc
>>
> FYI, I've done some more work on enhancing JPA2 converter - I think it
> is now quite functional/capable, please check the JPA2 section:
>
> https://cwiki.apache.org/confluence/display/CXF20DOC/JAX-RS+Advanced+Features#JAX-RSAdvancedFeatures-JPA2.0
>
>
> and QueryContext has been introduced to make it simpler in to integrate
> it all into the higher-level tooling and such:
>
> https://cwiki.apache.org/confluence/display/CXF20DOC/JAX-RS+Advanced+Features#JAX-RSAdvancedFeatures-JPA2.0

sorry,

https://cwiki.apache.org/confluence/display/CXF20DOC/JAX-RS+Advanced+Features#JAX-RSAdvancedFeatures-ConvertingFIQLquerieswithQueryContext

Sergey

>
>
> I'm going to test it on my end in our tooling project, but I'd
> appreciate some feedback too
>
> Thanks, Sergey
>
>
>> Cheers, Sergey
>>
>>>
>>> Best regards.
>>> Jan
>>>
>>> From: Sergey Beryozkin-5 [via CXF]
>>> [mailto:[hidden email]</user/SendEmail.jtp?type=node&node=5718844&i=0>]
>>> 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<
>>>
>>>
>>> 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.
>>
>>
>
>


________________________________
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-tp5717638p5718844.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-tp5717638p5718845.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: JAX-RS Method overloading?

Posted by Sergey Beryozkin <sb...@gmail.com>.
On 20/11/12 15:43, Sergey Beryozkin wrote:
> Hi,
> On 15/11/12 13:58, Sergey Beryozkin wrote:
>> Hi Jan
>> On 15/11/12 07:52, janb wrote:
>>> 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.
>>
>> I'm still doing some work on enhancing JPA2 converter, specifically, to
>> do with the support for collections (and joins). IMHO, the search
>> extension can become very useful once we get more coverage of various
>> popular search technologies. LDAP plus most of the big data related dbs
>> will be supported, etc
>>
> FYI, I've done some more work on enhancing JPA2 converter - I think it
> is now quite functional/capable, please check the JPA2 section:
>
> https://cwiki.apache.org/confluence/display/CXF20DOC/JAX-RS+Advanced+Features#JAX-RSAdvancedFeatures-JPA2.0
>
>
> and QueryContext has been introduced to make it simpler in to integrate
> it all into the higher-level tooling and such:
>
> https://cwiki.apache.org/confluence/display/CXF20DOC/JAX-RS+Advanced+Features#JAX-RSAdvancedFeatures-JPA2.0

sorry,

https://cwiki.apache.org/confluence/display/CXF20DOC/JAX-RS+Advanced+Features#JAX-RSAdvancedFeatures-ConvertingFIQLquerieswithQueryContext

Sergey

>
>
> I'm going to test it on my end in our tooling project, but I'd
> appreciate some feedback too
>
> Thanks, Sergey
>
>
>> Cheers, Sergey
>>
>>>
>>> Best regards.
>>> Jan
>>>
>>> From: Sergey Beryozkin-5 [via CXF]
>>> [mailto:ml-node+s547215n5717643h84@n5.nabble.com]
>>> 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.
>>
>>
>
>


Re: JAX-RS Method overloading?

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi,
On 15/11/12 13:58, Sergey Beryozkin wrote:
> Hi Jan
> On 15/11/12 07:52, janb wrote:
>> 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.
>
> I'm still doing some work on enhancing JPA2 converter, specifically, to
> do with the support for collections (and joins). IMHO, the search
> extension can become very useful once we get more coverage of various
> popular search technologies. LDAP plus most of the big data related dbs
> will be supported, etc
>
FYI, I've done some more work on enhancing JPA2 converter - I think it 
is now quite functional/capable, please check the JPA2 section:

https://cwiki.apache.org/confluence/display/CXF20DOC/JAX-RS+Advanced+Features#JAX-RSAdvancedFeatures-JPA2.0

and QueryContext has been introduced to make it simpler in to integrate 
it all into the higher-level tooling and such:

https://cwiki.apache.org/confluence/display/CXF20DOC/JAX-RS+Advanced+Features#JAX-RSAdvancedFeatures-JPA2.0

I'm going to test it on my end in our tooling project, but I'd 
appreciate some feedback too

Thanks, Sergey


> Cheers, Sergey
>
>>
>> Best regards.
>> Jan
>>
>> From: Sergey Beryozkin-5 [via CXF]
>> [mailto:ml-node+s547215n5717643h84@n5.nabble.com]
>> 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.
>
>


-- 
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com

Re: JAX-RS Method overloading?

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi Jan
On 15/11/12 07:52, janb wrote:
> 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.

I'm still doing some work on enhancing JPA2 converter, specifically, to 
do with the support for collections (and joins). IMHO, the search 
extension can become very useful once we get more coverage of various 
popular search technologies. LDAP plus most of the big data related dbs 
will be supported, etc

Cheers, Sergey

>
> Best regards.
> Jan
>
> From: Sergey Beryozkin-5 [via CXF] [mailto:ml-node+s547215n5717643h84@n5.nabble.com]
> 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.


-- 
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com