在Wildfly中重定向到index.html

时间:2016-09-08 15:14:33

标签: java redirect jax-rs wildfly

我有一个用Java EE编写的应用程序,它正在使用WildFly Application Server。我的应用程序路径已设置:

@ApplicationPath("api")
public class ApplicationConfig extends Application{}

所以,如果我想查看我的应用的index.html,请输入http://localhost:8080/my_app_name。有没有办法重定向所有请求,例如localhost:8080 / my_app_name / something_different_than_api到index.html文件?

1 个答案:

答案 0 :(得分:0)

解决方案是添加到文件web.xml错误页面标记:

<error-page>
     <error-code>404</error-code>
     <location>/index.html</location>
</error-page>