ExceptionMapper not work in grizzly

杀马特。学长 韩版系。学妹 提交于 2019-12-06 07:47:08

Make sure you have the RESPONSE_SET_STATUS_OVER_SEND_ERROR property set.

I had the same problem with grizzly and it was capturing my catching my 400 and sending back the default generic servlet error page. This was the solution for jersey 2.

public class RestApplication extends ResourceConfig {

    private static final Logger logger = Logger.getLogger(RestApplication.class.getName());

    public RestApplication() {
        // Set this property so that the 400 will still send the entity correctly.
        property(ServerProperties.RESPONSE_SET_STATUS_OVER_SEND_ERROR, "true");
        registerModules();
    }
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!