Adjusting web.xml listeners, filters and servlets

非 Y 不嫁゛ 提交于 2019-12-22 10:55:02

问题


Following is outline of what I have in my web.xml config file. I need help putting this into the correct order.

web.xml web-app

 1. contextConfigLocation applicationContext.xml
 2. defaultHtmlEscape true
 3. listeners 
 4. servlets 
 5. filters <order sensitive>    
 6. session-config timeout 120
 7. error page 404 500

UPDATE:

I'm getting ClassNotFoundException on all my listeners in tomcat's logs/localhost.log There are not problems after the application starts just log entries that indicate that something is off.

I have organized it as per BalusC's suggestions. Any idea why is this happening?

Where should the session-config go?


回答1:


Only the order of the <filter-mapping> elements is relevant. It will be the actual order how the filters are invoked whenever the request URL matches the url-pattern of more than one filter. A filter can namely decide whether to continue the chain or not. The remnant has no significant influence on the functioning of the webapp. Just adhere the ordering as specified in DTD/XSD (if any) and/or whatever you feels it makes the best readable/maintainable. Generally, the ordering is as follows: context params, listeners, servlets, filters and error/welcome pages.



来源:https://stackoverflow.com/questions/5452804/adjusting-web-xml-listeners-filters-and-servlets

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