开发者

Url matching in java web application

开发者 https://www.devze.com 2023-03-03 00:45 出处:网络
In the context of url matching in java web applications, what is the difference b开发者_JS百科etween */ and *.*

In the context of url matching in java web applications, what is the difference b开发者_JS百科etween * / and *.*

Which of these patterns includes the others? Shouldn't * pattern accept / and *.* as well, Since a * wildcard should include everything else.

Please feel free to point to resources that explain this further.


An URL pattern of * or, more correct, /* (the leading forward slash is namely implicit on path-mapped URL patterns) matches everything. This thus also matches requests which would end up in /. This URL pattern is more common for a filter than for a servlet.

An URL pattern of / matches only requests which didn't match any of the other definied URL patterns. It becomes then the "default" servlet (and it will override the servletcontainer's builtin default servlet!).

The *.* is not a valid URL pattern.

This is all definied in chapter 12 of the Servlet API specification (on the linked site, click the download button of the one for evaluation).

0

精彩评论

暂无评论...
验证码 换一张
取 消