如何将Jboss的默认页面更改为应用程序的主页? [英] how to change Jboss default page to the home page of my application?

查看:192
本文介绍了如何将Jboss的默认页面更改为应用程序的主页?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在JBOSS中部署了一个应用程序,可以通过以下方式访问它:localhost/appname 当我仅输入IP地址时,我将被重定向到JBOSS默认页面. 是否有一种无需输入/appname即可转到应用程序主页的方法?

I have an application deployed in JBOSS and it is accessed as: localhost/appname When i enter only the IP address i get redirected to the JBOSS default page. Is there a way to go to the application's homepage with no need to give /appname ?

我希望问题清楚. 提前致谢.

I hope the question is clear. Thanks in advance.

推荐答案

Nightsorrow提供的解决方案的一部分,您还可以使用WEB-INF/jboss的context-root标记定义Web应用程序的上下文根. -web.xml文件.因此,将其定义为"/",就可以保留原始文件名.这样,您将覆盖JBoss的默认行为,该行为将Web应用程序的上下文根定义为应用程序的文件名(除非应用程序名称为ROOT.war,其默认上下文为'/').

A part of the solution given by Nightsorrow, you can also define the context root of your web application using the context-root tag of the WEB-INF/jboss-web.xml file. So defining it as '/', you can keep your original file name. This way you override the default behaviour of JBoss, which is defining the context root of web apps as the file name of the application (unless the app name is ROOT.war, which its default context is '/').

因此jboss-web.xml文件看起来类似于:

So the jboss-web.xml file would look like something similar to:

<jboss-web>
   ... other tags ...
   <context-root>/</context-root>
   ... other tags ...
</jboss-web>

请注意,不能有两个具有相同上下文根的应用程序,因此首先您必须删除ROOT.war,或按照相同的步骤更改其上下文根:

Notice that there can't be two applications with the same context root, so first you will have to remove ROOT.war, or change its context root following the same procedure:

  • 将上下文根标记添加到jboss-web.xml中(例如:<context-root>/oldRoot</context-root>,这将使旧的ROOT.war应用程序可通过localhost/oldRoot使用),或
  • 仅更改其文件名.
  • adding the context-root tag to jboss-web.xml (for example: <context-root>/oldRoot</context-root>, which would make the old ROOT.war application available through localhost/oldRoot),or
  • just changing its file name.

如果要部署一个内部带有Web模块(战争)的EAR文件(而不只是一个普通的war文件),则必须使用EAR的META-INF/application.xml.以此方式定义Web模块:

In case you want to deploy an EAR file with a web module (war) inside (instead of just a plain war file), you've to use the META-INF/application.xml of the EAR. Defining the web module this way:

<application>
        ... other tags and other modules (ejb, web ...) ...
    <module>
        <web>
            <web-uri>nameOfYourWarFile.war</web-uri>
            <context-root>/</context-root>
        </web>
    </module>
        ... other tags and other modules (ejb, web ...) ... 
</application>

这篇关于如何将Jboss的默认页面更改为应用程序的主页?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆