I have a service where the last part of the path is optional, the user can both enter /mypath/ and /mypath/param1/.
I tried to use a regular expression to filter the last part of the path:
@Path("/mypath{param1: (/param1)?}")
I'm using RestEasy as my JAX-RS provider and the code works as expected in Tomcat but when I deploy it in JBoss I get a 405 return code when I do not submit the optional part.
Am I doing something wrong here or it's not possible to accomplish this in a portable way?
question from:
https://stackoverflow.com/questions/5421104/optional-pathparam-in-jax-rs 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…