开发者

Tomcat, web.xml, exclude path

开发者 https://www.devze.com 2023-04-06 14:10 出处:网络
In my application, i need to process all the requests from users in a single servlet, however, i happen to have a folder with static content, which i would like to also serve statically.

In my application, i need to process all the requests from users in a single servlet, however, i happen to have a folder with static content, which i would like to also serve statically.

In my web.xml file, i have the following:

    <servlet>
        <servlet-name>all</servlet-name>
        <servlet-class>a.b.c.WidgetlistXml</servlet-class>
    </servlet>
    <servlet-mapping>
 开发者_如何学运维       <servlet-name>all</servlet-name>
        <url-pattern>/*</url-pattern>
    </servlet-mapping>

Is there a way i can exclude, say, all .zip files from this?

PS. I know this has been asked on StackOverflow before, but the latest posts were from about 2006, and they also concerned Spring or other frameworks. I use none, and since 2006 something could have changed in url-patterns. By the way, finding the docs on web.xml is not that simple either.

Thank you in advance.


Set a DefaultServlet for your static contents. Here is an example: http://tomcat.apache.org/tomcat-7.0-doc/default-servlet.html#where

0

精彩评论

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