servlet模式“/”和“/ pattern / *”之间的servlet有何不同?

时间:2015-01-22 11:44:49

标签: java servlets url-pattern contextpath

我想找到servlet的额外路径信息。但是,根据客户使用的url模式,此信息的编码不同。在以下示例中,我希望在案例(2)和(3)之间有所不同。这可能吗?

url-pattern: /pattern/*
===================
(1) http://localhost/context/pattern/path
ContextPath: /context
ServletPath: /pattern
PathInfo:    /path

(2) http://localhost/context/pattern
ContextPath: /context
ServletPath: /pattern
PathInfo:    null


url-pattern: /
===================
(3) http://localhost/context/path
ContextPath: /context
ServletPath: /path
PathInfo:    null

(4) http://localhost/context/
ContextPath: /context
ServletPath: /
PathInfo:    null


url-pattern: /*
===================
(5) http://localhost/context/path
ContextPath: /context
ServletPath: 
PathInfo:    /path

(6) http://localhost/context/
ContextPath: /context
ServletPath: 
PathInfo:    /

0 个答案:

没有答案