Thursday May 09, 2013

HTTP Upgrades in Servlet 3.1

Servlet 3.1 is a relatively minor release slated for Java EE 7. However, the Java EE foundational API still contains some very important changes, especially for folks building on the Servlet API. The newly added support for HTTP protocol upgrades is a great example. The upgrade facility has been there since HTTP 1.1, but just hasn't been used that widely. It facilitates building richer protocols on top of HTTP. Under the hood, this is exactly the mechanism that HTML 5 WebSockets use (as you know, we now have excellent support for WebSockets in Java EE via JSR 356). You can most certainly use HTTP protocol upgrades in similarly powerful and innovative ways yourself.

Servlet 3.1 co-spec lead Shing Wai Chan shows you how in his recent code example driven post. Incidentally, Servlet 3.1 recently passed it's final approval ballot. You could check out the proposed final draft yourself.