-
Bug
-
Resolution: Done
-
Major
-
1.2.RC1
-
None
-
None
When using RESTEasy Spring integration (by including the springmvc-resteasy.xml), the bean "resteasy.exception.handler" is configured to map the "org.jboss.resteasy.spi.NoResourceFoundFailure" to a "resteasy.no.resource.found.view" (bean for class org.jboss.resteasy.springmvc.ResteasyNoResourceFoundView).
If the resteasy.handlerMapping is configured with throwNotFound=true, a request to e.g. a non-existing resource should return a 404 response code, but it returns a 500 response code. The behaviour is caused by the rendering in ResteasyNoResourceFoundView, below is a patch to fix this.
There seems to be a problem with other response codes as well, e.g. a request with a "Accept" header that is not mapped causes a org.jboss.resteasy.spi.NotAcceptableException, but this results again in a 500 response code instead of the expected 406. I have fixed this behaviour by reconfiguring the error handling in springmvc-resteasy.xml, if interested I can supply my configuration.
Patch for ResteasyNoResourceFoundView:
Index: ResteasyNoResourceFoundView.java
===================================================================
— ResteasyNoResourceFoundView.java (revision 839)
+++ ResteasyNoResourceFoundView.java (working copy)
@@ -42,7 +42,7 @@
return null;
}
- };
+ }.handle(new ResteasyRequestWrapper(request), response);
}
@SuppressWarnings("unchecked")