tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Funk <funk...@apache.org>
Subject Re: Static resource mapping in web.xml
Date Wed, 08 Jun 2011 15:44:02 GMT
 No - images will be served by the default servlet so nothing needs to be
done for images.

The filter is used as a way to let the invoker work and be a tiny bit more
secure. So the filter is mapped to /* and will forward anything to the
invoker serllet if the requested path *looks like one of your classes*. ...
otherwise the filter uses chain.doFilter(...)  to let the request be handled
by any other mapped servlets. (In this case the default servlet)

There are many tutorials on the web about filters


-Tim

On 6/8/2011 11:25 AM, falvarez@geocom.com.uy wrote:

Interesting Tim. But a little confusing for me.

Never used filters, but for what you said and I googled: I would have to
build a filter and map it to "/images/*", right?

Something like:
    <filter>
        <filter-name>Resource filter</filter-name>
        <filter-class>com.mycompany.resourcefilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>Resource filter mapped</filter-name>
        <servlet-name>/images/*</servlet-name>
    </filter-mapping>

If I understand correctly, every request made to this URL path will be
answerd with what I declare in the filter.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message