OmniFaces ExtensionlessURL功能不适用于瘦的WAR文件

时间:2015-12-14 11:58:00

标签: jsf wildfly websphere-liberty omnifaces skinny-war

我正在我的一个项目中使用OmniFaces ExtensionlessURL FacesViews功能,并且发现当Web应用程序在EAR存档中打包为瘦的WAR存档并部署到Wildfly容器或其中时,此功能似乎不起作用。 WebSphere Liberty Profile容器。如果我尝试访问没有.xhtml后缀的页面,则在两个容器上都会出现404错误。

如果我将包含瘦的WAR存档的相同EAR存档部署到GlassFish容器或WebLogic容器,则ExtensionlessURL功能将按预期工作,并且可以访问不带.xhtml后缀的页面。

如果我部署包含正常WAR存档的EAR存档(即OmniFaces jar存储在WAR存档的WEB-INF / lib文件夹中),则ExtensionlessURL在WildFly容器和WebSphere Liberty Profile容器上按预期工作除了GlassFish和WebLogic容器之外。

我使用的WildFly版本是9.0.2,WebSphere Liberty Profile的版本是8.5.5.7。我正在使用的OmniFaces版本是2.2

我的配置中是否可以更改某些内容以允许OmniFaces Extensionless URL功能与Wildfly和WebSphere Liberty配置文件容器上的瘦WAR存档一起使用,或者这是一个错误吗?

要解决此问题,我创建了一个自包含的示例,其中包含重现问题所需的最低限度。

web.xml文件如下:

<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
    version="3.1">

    <context-param>
        <param-name>org.omnifaces.FACES_VIEWS_SCAN_PATHS</param-name>
        <param-value>/*.xhtml</param-value>
    </context-param>

    <servlet>
        <servlet-name>facesServlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
        <async-supported>true</async-supported>
    </servlet>
    <servlet-mapping>
        <servlet-name>facesServlet</servlet-name>
        <url-pattern>*.xhtml</url-pattern>
    </servlet-mapping>

    <welcome-file-list>
        <welcome-file>index.xhtml</welcome-file>
    </welcome-file-list>

</web-app>

Maven WAR插件的配置如下:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>2.6</version>
    <configuration>
        <failOnMissingWebXml>false</failOnMissingWebXml>
        <packagingExcludes>WEB-INF/lib/*.jar</packagingExcludes>
        <archive>
            <manifest>
                <addClasspath>true</addClasspath>
                <classpathPrefix>lib/</classpathPrefix>
            </manifest>
        </archive>
    </configuration>
</plugin>

Maven EAR插件的配置如下:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-ear-plugin</artifactId>
    <version>2.10.1</version>
    <configuration>
        <version>7</version>
        <defaultLibBundleDir>lib</defaultLibBundleDir>
        <skinnyWars>true</skinnyWars>
        <modules>
            <webModule>
                <groupId>${project.groupId}</groupId>
                <artifactId>extensionless-web</artifactId>
                <context-root>/extensionless-web</context-root>
            </webModule>
        </modules>
    </configuration>
</plugin>

Maven EAR项目还包含以下依赖项,以从WAR项目中获取依赖项:

<dependency>
    <groupId>${project.groupId}</groupId>
    <artifactId>extensionless-web</artifactId>
    <version>${project.version}</version>
    <type>pom</type>
</dependency>

0 个答案:

没有答案