java - Wrong rest service is selected -



java - Wrong rest service is selected -

i have resource 2 methods:

@get @path("/{date}") public response getpartnerinteractionsbydate( @pathparam("partnerid") int partnerid, @pathparam("date") string date ); @get @path("/{interactionid}") public response getpartnerinteraction( @pathparam("partnerid") int partnerid, @pathparam("interactionid") int interactionid );

how can select 1 or service? if set "1" interactionid, still method date gets executed. using apache cxf 3.0.1. give thanks you

there 2 problems. first path must contain pathparams you're binding. second, 2 paths identical in both take 2 parameters of same type (cxf has no way of knowing difference between int , string containing int).

try this:

@get @path("/{partnerid}/date/{date}") public response getpartnerinteractionsbydate( @pathparam("partnerid") int partnerid, @pathparam("date") string date ); @get @path("/{partnerid}/{interactionid}) public response getpartnerinteraction( @pathparam("partnerid") int partnerid, @pathparam("interactionid") int interactionid );

java rest cxf jax-rs uritemplate

Comments

Popular posts from this blog

c - Compilation of a code: unkown type name string -

java - Bypassing "final local variable defined in an enclosing type" -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -