Tuesday, October 14, 2008

Servlet 3.0

Today's java.net article An Introduction To Servlet 3.0 has a pretty good overview of some of the things we might expect in the upcoming Servlet 3.0 API. 1)I'm not sure I like the use of annotations for servlets, perhaps I'm just getting old and cranky. Class hierarchies provide clarity. I've been using annotations in Spring MVC with mixed feelings. 2)I really like the idea of WebFragments for frameworks can automatically add their own stuff. I hope there's a way to disable it though. I can see some problems using a jar file that contains a web fragment and not really knowing it's even there. It could be filtering some other requests. Ouch! 3) Programmatic login/logout. It's about time we have reasonable flexibility for authentication. There are those that will says it's too little/too late because of Spring Security/Acegi. I like these too, but as much as you like to pretend, its not a standard, its not even a de facto standard. This is likely to be the best thing to come out of the new spec. I hope they get it right the first time. 4) The asynchronous support intrigues me. I'd like to get my hands on this and try some scalability testing. 5) HTTP Only cookies to prevent some cross-site scripting sounds promising. I'll have to look into some hacks to find out if this is of any practical use. 6) I agree with one of the commenters. Where are the generics? Generics provide consistency. If they can be introduced into the API without breaking backwards compatibility then just do it. They were fitted into the Collections API, so I think getParameterMap etc could slip it in no problem. By the way how about some new methods to get around those methods that return Enumeration. The Enumeration class needs to go. How about an Iterator or an Iterable so getHeaders() can be used in an enhanced for loop.