java.lang.IllegalArgumentException: Invalid <url-pattern> in servlet mapping

回眸只為那壹抹淺笑 提交于 2019-11-26 12:23:30
McDowell
<url-pattern>*NEXTEVENT*</url-pattern>

The URL pattern is not valid. It can either end in an asterisk or start with one (to denote a file extension mapping).

The url-pattern specification:

  • A string beginning with a ‘/’ character and ending with a ‘/*’ suffix is used for path mapping.
  • A string beginning with a ‘*.’ prefix is used as an extension mapping.
  • A string containing only the ’/’ character indicates the "default" servlet of the application. In this case the servlet path is the request URI minus the context path and the path info is null.
  • All other strings are used for exact matches only.

See section 12.2 of the Java Servlet Specification Version 3.1 for more details.

A workaround that can achieve that is to add a servlet filter to do URL re-writes e.g. re-write NEXTEVENT to /NEXTEVENT/(the one before the NEXTEVENT)/(the one after NEXTEVENT) or something similar.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!