在WildFly上将Java EE应用程序部署为根上下文

时间:2015-08-16 16:44:44

标签: eclipse java-ee jboss wildfly

我正在使用Eclipse Mars IDE + JBoss AS(WildFly 9.0.1)。然后我启动服务器,一切正常。我想知道如何将应用程序设置为根上下文? 要运行我的应用程序,我必须这样做: http://localhost:8080/demoApp,但我想这样做:http://localhost:8080/

下面是文件代码的片段:standalone.xml。 我修改了它,你可以在下面看到,但我得到: 403 - 禁止到:http://localhost:8080/。请记住,WildFly服务器是使用Eclipse调试器启动的,因为我处于开发模式。

...
<subsystem xmlns="urn:jboss:domain:undertow:2.0">
    <buffer-cache name="default" />
    <server name="default-server">
        <http-listener name="default" socket-binding="http"
            redirect-socket="https" />
        <host name="default-host" alias="localhost">
            <location name="/" handler="demoApp" />
            <filter-ref name="server-header" />
            <filter-ref name="x-powered-by-header" />
        </host>
    </server>
    <servlet-container name="default">
        <jsp-config />
        <websockets />
    </servlet-container>
    <handlers>
        <file name="welcome-content" path="${jboss.home.dir}/welcome-content" />
        <file name="demoApp" path="${jboss.home.dir}/standalone/deployments/demoApp.war" />
    </handlers>
    ...

2 个答案:

答案 0 :(得分:1)

更好的选择是添加

<bean id="ftpClientFactory" class="org.springframework.integration.ftp.session.DefaultFtpSessionFactory">
    <property name="host" value="${host}"/>
    <property name="port" value="${availableServerPort}"/>
    <property name="username" value="${userid}"/>
    <property name="password" value="${password}"/>
</bean>
<int-ftp:inbound-channel-adapter id="ftpInbound"
            channel="ftpChannel"
            session-factory="ftpClientFactory"
            filename-pattern="*.txt"
            auto-create-local-directory="true"
            delete-remote-files="false"
            remote-directory="/"
            local-directory="#{ T(org.springframework.integration.samples.ftp.TestSuite).LOCAL_FTP_TEMP_DIR}/ftpInbound">
        <int:poller fixed-rate="1000"/>
</int-ftp:inbound-channel-adapter>

<int-ftp:outbound-channel-adapter  id="ftpOutbound"
                channel="ftpChannel"
                remote-directory="/"
                session-factory="ftpClientFactory">
                <int-ftp:request-handler-advice-chain>
                    <int:retry-advice />
                </int-ftp:request-handler-advice-chain>
</int-ftp:outbound-channel-adapter>

<int:channel id="ftpChannel">
    <int:queue/>
</int:channel>

进入jboss-web.xml

答案 1 :(得分:0)

只需部署为ROOT.war并在standalone.xml中禁用默认的根网站应用程序,记录器会告诉您要更改的配置属性的名称