Catch-all (wildcard) servlet url-pattern overrides file extension patterns

servlets, url-pattern, web.xml, zk

Solution

I just found a solution through this question: Difference between / and /* in servlet mapping url pattern

Using '/' instead of '/*' did the trick for me.

<servlet-mapping>
  <servlet-name>myContentServlet</servlet-name>
  <url-pattern>/</url-pattern>
</servlet-mapping>

Problem

I would like to achieve the following: ``` /webapp-context/Page-1 -> Handled by my custom "ContentServlet" /webapp-context/Another-Page -> Handled by my custom "ContentServlet" /webapp-context/Page-with-long-title -> Handled by my custom "ContentServlet" /webapp-context/_cms/<something>.zul -> Handled by ZK framework ``` My latest attempt looks like this (web.xml extract): ``` <servlet-mapping> <servlet-name>zkLoader</servlet-name> <url-pattern>*.zul</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>myContentServlet</servlet-name> <url-pattern>/*</url-pattern> </servlet-mapping> ``` Unfortunately now my content servlet handles all requests (I thought the more specific pattern takes precedence?). No conflict exists if i map my content servlet to the pattern "/webapp-context/content/*", but that's not what I want. Thanks for your time.

Original source