开发者

web.xml configuration to load html files directly

开发者 https://www.devze.com 2023-02-26 04:59 出处:网络
I need to setup a web app 开发者_C百科in JBoss to load html files directly from a .war file. What do i need to add to the web.xml file to enable this?

I need to setup a web app 开发者_C百科in JBoss to load html files directly from a .war file. What do i need to add to the web.xml file to enable this?

This is my web.xml file:

<web-app>
    <display-name>ws</display-name>
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>WEB-INF/applicationContext.xml</param-value>
    </context-param>

    <listener>
        <listener-class>
            org.springframework.web.context.ContextLoaderListener
        </listener-class>
    </listener>

    <servlet>
        <servlet-name>CXFServlet</servlet-name>
        <display-name>CXF Servlet</display-name>
        <servlet-class>
            org.apache.cxf.transport.servlet.CXFServlet
        </servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>CXFServlet</servlet-name>
        <url-pattern>/*</url-pattern>
    </servlet-mapping>

    <resource-ref>
        <res-ref-name>SIMDS</res-ref-name>
        <mapped-name>SIMDS</mapped-name>
        <res-type>javax.sql.DataSource</res-type>
        <res-auth>Container</res-auth>
        <res-sharing-scope>Shareable</res-sharing-scope>
    </resource-ref>
</web-app>


It is not so much what you need to add but what you need to change. If you look at the servlet-mapping for CXFServlet, you are specifying that all requests to the context of the application are to be mapped to that servlet.

Put more specificity there and you should be able to access HTML files directly from the context assuming they are in the correct location in the WAR file.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号