No reflection is required, because the base ExceptionMapper
being extended is still defined in both JAX-RS v1 and v2. You do have to write the code to handle the exception though, as well as return a response object of the same shape that Confluecne would normally. The form outlined in my earlier post works for me on both Confluence 7 and 9.
You could alternatively try @aragot 's trick of declaring two <rest>
resources, <restrict>
ing each resource to a specific range of Confluence versions, and also scoping each <rest>
resource to a different <package>
.