Polymorphic REST methods involved based on optional query params?

34 views
Skip to first unread message

Casey Jordan

unread,
Jun 21, 2015, 12:02:42 PM6/21/15
to gwt-pl...@googlegroups.com
I am using rest delegates and I am trying to figure out how I can have optional query params, which when matched by the annotation system will call different methods. 

For instance, in the example below, I have one endpoint which gets called when there is no optional ?additional=... query param. And another when that query param is present. 

However, the first one always gets called, even when I have the additional query param. Can anyone tell me how to do this?

Thanks!

@Path("/metrics")
MetricsResource metrics();

@Path("/metrics")
MetricsResource metrics(@QueryParam("additional") String additional);
 
--
--
Casey Jordan
easyDITA a product of Jorsek LLC
"CaseyDJordan" on LinkedIn, Twitter & Facebook
(585) 348 7399
easydita.com


This message is intended only for the use of the Addressee(s) and may
contain information that is privileged, confidential, and/or exempt from
disclosure under applicable law.  If you are not the intended recipient,
please be advised that any disclosure  copying, distribution, or use of
the information contained herein is prohibited.  If you have received
this communication in error, please destroy all copies of the message,
whether in electronic or hard copy format, as well as attachments, and
immediately contact the sender by replying to this e-mail or by phone.
Thank you.

Olivier Lafleur

unread,
Jul 7, 2015, 4:52:12 PM7/7/15
to gwt-pl...@googlegroups.com
From the top of my head, I would guess that you could make your first function a private one to be called when ?additionnal is null or empty?

What do you think?
Reply all
Reply to author
Forward
0 new messages