Servlet Spec 3.0

One of the other interesting things on devoxx is the presentation of the coming JCP release for Servlet Spec 3.0.

A short list of changes.

A great addition to Servlets is modularization. Not everything needs to be defined in one web.xml file. But different modules/parts of an application can now have different fragmented

web.xml. In the same time there will be support for Annotations that can define stuff you would normally define the in web.xml file.

e.g.
@WebServlet (value=”/shoppingcart”)

Concerning the example:
I tought one of the points of the web.xml mappings was that it’s easy to change mappings without having to browse through your code. And having all the mappings together, is easy too see how everything is mapped. Hence, i’m not sure this is very useful(for me). In addition, this article by Roy van Rijn summarizes a bit what i was thinking at the time of the presentation.

The introduction of AsyncRequests brings great opportunities for applications that require asynchronous communications or that can handle long-term connections. Very useful for Ajax applications (or JavaFX apps maybe..).

e.g. to make a request async:
AsyncContext.startAsync(req, resp); // request&response are optional ofcourse.

Last but not least, it will be possible to get the ServletRequest directly from the request instead of having to make your way through and around things to get it.

And in the future specs there are plans to do some file upload suppport.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: