An HTTP request URL contains the following parts:
http://[host]:[port][request-path]?[query-string]
The request path is further composed of the following elements:
Context path: A concatenation of a forward slash (/) with the context root of the servlet’s web application.
Servlet path: The path section that corresponds to the component alias that activated this request. This path starts with a forward slash (/).
Path info: The part of the request path that is not part of the context path or the servlet path.
----------------
1.容器试图在web.xml中寻找匹配的请求URI。如果找到了,完整的请求URI(除去context路径)即servlet路径。
这时HttpServletRequest.getPathInfo()为null
2.使用/作为分隔符,将请求URI转化为目录树,并通过递归匹配web.xml中URL-PATTERN,获得最长的匹配路径.匹配部分即servlet path
其余为path info
3.如果请求URI的最后一个节点包含一个扩展名(如:.jsp),servlet容器会将它和处理这个种特定的扩展名servlet匹配.
这时, 完整的请求URI, 减去context path即servlet path, 并path info为null.
4.如果容器仍然不能匹配请求路径, 它会将请求forward到默认的servlet.如果没有默认的servlet, 它会发送一条说明服务器没有找到
指定文件未找到的错误信息(404)
----------------------
Context path: /lostyue, Servlet path: /index.html, Path info: null
Context path: /lostyue, Servlet path: /css/jquery-ui.css, Path info: null
Context path: /lostyue, Servlet path: /js/jquery.js, Path info: null
Context path: /lostyue, Servlet path: /js/jquery-ui.js, Path info: null
Session Destoryed! ---2012-03-14 21:01:22
Context path: /lostyue, Servlet path: /jsp/displayname.jsp, Path info: null
我在filter中打印这些信息的时候,在载入默认主页时,打印了一些script信息,有些不能理解。是不是涉及到js的一些处理?
这个和url-pattern是不是有些关系? 有待深入。
另外默认的访问页都是Index.html