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

I would like to do 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 last attempt looks like this (exe web.xml):

  <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 a more specific template took precedence?).

No conflict exists if I map my content servlet to the pattern "/ webapp-context / content / *", but that is not what I want.

Thank you for your time.

+8
servlets url-pattern zk
source share
1 answer

I just found a solution on this: The difference between / and / * in the servlet url mapping pattern

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

 <servlet-mapping> <servlet-name>myContentServlet</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> 
+11
source share

All Articles