为什么我不能在 jboss 中将我的应用设置为根上下文?

Why i cant set my app into root context in jboss ?

所以这是我第一次提问,

我的 jboss 配置有点问题。

我使用 jboss 6.2

已读过这篇文章

  1. http[:]//www.mastertheboss.com/jboss-web/jbosswebserver/how-to-deploy-a-web-application-on-the-root-context-on-jboss-as-7
  2. https[:]//developer.jboss[点]org/wiki/HowdoIoverridethewebcontextroot
  3. https[:]//Whosebug[点]com/questions/21957060/jboss-deploying-in-root-context

我做了什么?

  1. 创建jboss-web.xml
<?xml version="1.0" encoding="UTF-8"?>  
<jboss-web>  
    <context-root>/</context-root>  
</jboss-web>
  1. 在我的 standalone/configuration/standalone.xml
  2. 中将 enable-welcome-content 设置为 false
 <virtual-server name="default-host" enable-welcome-root="false">
  1. 将 myapp.war 更改为 ROOT.war 并部署到 standalone/deployments/
  2. 将我的欢迎文件列表设置为 login.xhtml
 <welcome-file-list>
<welcome-file>login.xhtml</welcome-file>
 </welcome-file-list>

这里的问题是

当请求root本身时 192.168.1.98 welcome-content

当我请求 192.168.1.86/login.xhtml

viola ! it works

我想要的是当我只请求 IP 地址时,它 link 到 login.xhtml。 现在,我必须请求我的 ip + login.xhtml ( 192.168.1.86/login.xhtml )

那我该怎么办呢?

需要你们的帮助。

欢迎任何想法。

谢谢。

您的设置是正确的..您缺少的是 index.html(放置在您的 wars 根文件夹中)重定向到您的登录页面..

当您请求 192.168.1.86 时,您的 index.html 被读取。因此,您需要从那里重定向到您的登录页面。

例如:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
    <!-- forward to your login -->
    <meta http-equiv="refresh" content="0;url=login.xhtml;charset=utf-8">
</head>
</html>