如何在 Wildfly 中定义上下文路径? [英] How to define Context Path in Wildfly?

查看:27
本文介绍了如何在 Wildfly 中定义上下文路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用以下代码在 tomcat 中设置上下文路径,我可以通过覆盖 tomcat 的默认路径直接使用 localhost:8080 访问我的应用程序.

I've used the following code to set the Context Path in tomcat where I can access my application directly using localhost:8080 by overriding the tomcat's default path.

<Context path="" docBase="G:itbucketprojectpathprojectuildlibsproject-1.0" workDir="G:itbucketprojectpathprojectuildlibsproject-1.0work"  debug="0" reloadable="false" autoDeploy="true" unpackWARs="true" crossContext="true"/>

现在我将使用 wildfly-8.2.0 作为运行时环境.我尝试将 .war 文件直接粘贴到 G:wildfly-8.2.0.Finalstandalonedeployments 中,我可以在浏览器中访问我的项目,例如 localhost:8080/project-1.0.

Now I'm going to use wildfly-8.2.0 as runtime environment. I tried by directly pasting the .war file into G:wildfly-8.2.0.Finalstandalonedeployments and I can access my project in browser like localhost:8080/project-1.0.

我需要像我在 tomcat 中所做的那样为 wildfly 设置相同的配置,以便通过覆盖 wildfly 的默认欢迎页面来访问我在 localhost:8080 中的项目.我试图在 Wildfly 中做同样的事情,但我被困在哪里做那件事.Wildfly 文件夹中有很多 .xml 文件(与 tomcat 的简单 server.xml 文件相比),我对从哪里开始感到困惑.我使用如何在 Wildfly 中设置上下文路径"进行搜索,但没有成功.任何人都可以帮助我如何做到这一点..?如果它与编码有关,那么我可以进行大量搜索,至少我可以获得一些想法,但是我在配置方面被困在这里.提前致谢.

I need to setup the same configuration to wildfly like I've done in tomcat to access my project in localhost:8080 by overriding the wildfly's default welcome page. I tried to do the same in wildfly but I'm stuck where to do that. There are lot of .xml files in wildfly folder (when comparing with tomcat's simple server.xml file) which I get confused on where to start with. I searched using "How to set Context Path in Wildfly", but got no success. Can anyone help me on how to do it..? If it's related to coding, then I can do lot of searches and atleast I can get some Ideas, but I'm stuck here at configuration. Thanks in Advance.

推荐答案

您可以通过在您部署的应用程序中添加/WEB-INF/jboss-web.xml 文件来执行此操作:

You can do this in the by adding a /WEB-INF/jboss-web.xml file in the application that you deploy:

<?xml version="1.0" encoding="UTF-8"?>
<jboss-web xmlns="http://www.jboss.com/xml/ns/javaee"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="
      http://www.jboss.com/xml/ns/javaee
      http://www.jboss.org/j2ee/schema/jboss-web_5_1.xsd">
   <context-root>/</context-root>
</jboss-web>

这篇关于如何在 Wildfly 中定义上下文路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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