servlet 3.0 规范对动态性的改变
很久没看servlet的新版本的变化了,前两天顺便看了一眼,发现改变还真是比较迎合我的心意。
去年和bluedavy在讨论osgi的时候说过,servlet规范强制把各种filter/servlet mapping定义在web.xml中,是阻碍模块化的罪魁祸首,那现在看看这段:
为了达到零配置和可插拔的目标,规范中建议了几种新特性,其中包括:
- Annotation(注释):Servlet 3.0规范引入了大量新的Annotation,比如@Servlet,它为Servlet提供了url-mapping信息——@Servlet(url-mapping=”/foo”);@ServletFilter,它与@FilterMapping一起使用,可以定义Web应用程序中的过滤器。
- 支持web.xml片段(flag):其中包含Servlet、过滤器和监听器的定义,可以与web.xml合并到一起,允许Web框架将所需的控件打包到一个jar中,这样使用起来可以更容易。
这样的话,OSGi做插件体系就更加方便了!
目前jetty 7是支持3.0 draft的,tomcat那边貌似还没看见动静。希望早点能到来。
Did you enjoy this post? Why not leave a comment below and continue the conversation, or subscribe to my feed and get articles like this delivered automatically each day to your feed reader.

No comments yet.
Leave a comment
Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>