The problem was the lack of whitespace before the colon:
@Path("/mypath{param1: (/param1)?}")
should be:
@Path("/mypath{param1 : (/param1)?}")
Apparently it’s a bug, because the specification makes the whitespace around the colon optional. I also found that I’m not the first bitten by this bug.