java - Regarding REST Path Conflict -
i creating 2 methods(get) in rest service in url first method of form
/a/b/{parameter}?start=1 & end=100 & name="some value"
and sec method
/a/b/{parameter}
when run code gives conflict. can please suggest me how these can configured methods , create query paramters optional?
thanks
this should work fine:
@get @path("/a/b/{parameter}") public response get(@pathparam("parameter") string parameter, @queryparam("start") integer start, @queryparam("end") integer end, @queryparam("name") string name) { // switch here according values received. optional , non-sent nulls here }
if in future have default values can add together them inline (for name query param example):
@defaultvalue("some-name") @queryparam("name") string name
java rest jersey jax-rs
No comments:
Post a Comment