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. Am I in the correct way? -----Mensaje original----- De: Tim Funk [mailto:funk...@apache.org] Enviado el: miércoles, 08 de junio de 2011 11:47 Para: Tomcat Users List Asunto: Re: Static resource mapping in web.xml Your "easiest" workaround is to use a filter. So 1) have the default servlet map to /* (which is the default) 2) keep the invoker declared 3) And make your filter do this ... doFilter(..) { if (request.getServletPath().matches(regex-here)) { servletContext.getNamedDispatcher("invoker").forward(request,response); return; } chain.doFilter(...) } Where regex-here is something which limits the mayhem you are imposing on yourself .. like this: "/servlet/com\.yourcompany\..+" -Tim On 6/8/2011 10:17 AM, falva...@geocom.com.uy wrote: Dear all, I'm faceing the following problem in tomcat (probably just configuration). I have a WEBAPP which uses the "invoker" servlet (i know how bad it is, but for now it gets the job done). The static content is under "/images/" path. So a tipical URL was like"http://host:8080/webapp/servlet/home" <http://host:8080/webapp/servlet/home>. To avoid the "servlet" part of the URL I layed hands in "web.xml". This is the result: <web-app> <servlet-mapping> <servlet-name>invoker</servlet-name> <url-pattern>/*</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>/images/*</url-pattern> </servlet-mapping> </web-app> The problem is that static content is not shown under "images", it is shown under "images/images". For example: http://host:8080/webapp/images/help.png ERROR http://host:8080/webapp/images/images/help.png OK In order to keep things as tidy as possible I would like static content to be served under "images". Using ROOT is not an option because this tomcat is shared among several WEBAPPS. Is there anything wrong with my configuration or am I missing something? This post addresses the same issue: http://stackoverflow.com/questions/234210/can-anyone-explain-servlet-mapping Thanks in advance and please excuse my bad English. Best regards, Federico. OS CentOS 5 Tomcat 6.0.29 JVM 1.6.0_20-b02 --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org