从tomcat到jetty的错误处理程序

时间:2021-06-07 13:38:11

I'm trying migrate webapp from tomcat to jetty (with jetty-runner) and this is the problem:

我正在尝试将webapp从tomcat迁移到jetty(使用jetty-runner),这就是问题所在:

In any class in my rest api I throw an Exception and in my tomcat, I had configured an error jsp to process, parse and to return a specific formatted message with json syntax. The configuration in tomcat had web.xml:

在我的休息api的任何类中,我抛出一个异常,在我的tomcat中,我已经配置了一个错误jsp来处理,解析并返回一个带有json语法的特定格式化消息。 tomcat中的配置有web.xml:

<servlet>
    <servlet-name>errorJSP</servlet-name>
    <jsp-file>/errors.jsp</jsp-file>
</servlet>
<servlet-mapping>
    <servlet-name>errorJSP</servlet-name>
    <url-pattern>/error</url-pattern>
</servlet-mapping>

<error-page>
    <error-code>500</error-code>
    <location>/error</location>
</error-page>

Now, I launch the webapp with jetty and this configuration don't run. After throw exception, the rest api return 500 and the execution don't pass by my jsp

现在,我使用jetty启动webapp,并且此配置不会运行。抛出异常后,其余的api返回500并且执行不会通过我的jsp传递

1 个解决方案

#1


0  

It works for me in my app on Jetty:

它适用于我在Jetty上的应用程序:

<error-page>
    <error-code>500</error-code>
    <location>/WEB-INF/jsp/error.jsp</location>
</error-page>

#1


0  

It works for me in my app on Jetty:

它适用于我在Jetty上的应用程序:

<error-page>
    <error-code>500</error-code>
    <location>/WEB-INF/jsp/error.jsp</location>
</error-page>