- RESTeasy is registered as filter (web.xml -> FilterDispatcher)
- The requested resource exists with GET and POST method
Running a request with e.g. PUT results in a MethodNotAllowedException in org.jboss.resteasy.core.registry.Segment.match(String, MediaType, List<MediaType>).
This exception is not catched in RESTeasy and bubbles up the complete stack until the server creates 500 with an exception page.
This happens because in org.jboss.resteasy.core.SynchronousDispatcher.invokePropagateNotFound(HttpRequest, HttpResponse) the getInvoker is outside of the try/catch block so the exception goes up to org.jboss.resteasy.plugins.server.servlet.FilterDispatcher.doFilter(ServletRequest, ServletResponse, FilterChain), but there only a NotFoundException is catched. Since NotFoundException and MethodNotAllowedException don't derive from each other the exception bubbles up outside of RESTeasy.
In my opinion the MethodNotAllowedException should be handled the normal way (405 response). To do this getInvoker in SynchronousDispatcher.invokePropagateNotFound should be surrounded by a try/catch MethodNotAllowedException and in catch run the normal handleException process.