Hi,
When the requested media type in the "Accept" http header is not available on the server side, currently http status 500 is returned instead of 406 (Not Acceptable).
I traced the code and a simple change below in org.jboss.resteasy.springmvc.ResteasyHandlerMapping.getHandler(HttpServletRequest request) made it return the proper code:
catch (NotFoundException e)
{
if (throwNotFound)
{
throw e;
}
logger.error("Resource Not Found: " + e.getMessage(), e);
}
catch (NotAcceptableException na) { // Added this exception handler
logger.error("Not acceptable: " + na.getMessage(), na);
requestWrapper.setError(406, "The requested media type is not acceptable.");
return new HandlerExecutionChain(requestWrapper, interceptors);
}
catch (Failure e)
I'm using resteasy-spring-2.3.7.jar.
Is there any newer version that already addresses this issue or would it be possible to enhance the code in the future release?
I appreciate your help.
Yonghee