java - filter mapping to last path segment -


i trying map filter specific url in web.xml. problem there dynamic path segment in url , need map filter urls ending specific path. given urls:

http://company.com/webapp/aaa/end http://company.com/webapp/bbb/end http://company.com/webapp/ccc/end 

i need map servlet like:

<filter id="endfilter">     <filter-name>endfilter</filter-name>     <filter-class>com.company.endfilter</filter-class> </filter>  <filter-mapping>     <filter-name>endfilter</filter-name>     <url-pattern>*/end</url-pattern>  </filter-mapping> 

i know */ not valid wildcard dont know if type of mapping possible. easy map urls resources pictures endings *.png or *.jpeg wildcard can't find way map simple url path segment.

from servlet 3.1 specification chapter 12:

in web application deployment descriptor , following syntax used define mappings:

  • a string beginning / character , ending /* suffix used path mapping.
  • a string beginning *. prefix used extension mapping.
  • the empty string ("") special url pattern maps application's context root, i.e., requests of form http://host:port/. in case path info / , servlet path , context path empty string ("").
  • a string containing / character indicates "default" servlet of application. in case servlet path request uri minus context path , path info null.
  • all other strings used exact matches only.

so looks not possible.


Comments

Popular posts from this blog

How to connect android app to App engine -

gcc - MinGW's ld cannot perform PE operations on non PE output file -

php - display validation error message next to the textbox in codeigniter -