0

In the context of url matching in java web applications, what is the difference between * / 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.

1 Answer 1

1

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).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.