user3062513 user3062513 - 3 months ago 15
Java Question

Regarding optional path in JAX-RS

I want to pass an optional parameter in the JAX-RS path.I am using the below path but its not working.


The resource should get invoked for both with userid and without user id parameter in the path.
Can anyone suggest me what needs to be done?



You could take out the / between the two template parameters and insert it into the regex of the userId


Won't make a difference, but the extra wrapping parenthesis are not needed,
i.e. this {userid: (/[a-zA-Z]{2})?} is sufficient