JavaOne 2008 - Java Servlet 3.0 API: What’s New and Exciting

6:45 am Java

The session “Java Servlet 3.0 API: What’s New and Exiciting” was presented by Rajiv Mordani, SUN Microsystems.

The Java Servlet 3.0 API is defined by JSR 315 and will become part of the Java EE 6 specification.  This talk focused on the new features of the API.

The “web.xml” file will be optional.  JAR and WAR packages will now be able to contain their own “web fragment” definitions.  A web fragment will have the same structure as a “web.xml” file, but will be surrounded by the  <web-fragment> tag.

A number of ease of development features are going to be included.  Developers will be able initialize Servlets and Filters at run time (i.e. create them in code) instead of at start-up time.  Annotations and generics have been added to make Servlet and Filter creation much easier.  The annotation @Servlet(url-mapping=”/myservlet”) creates a new servlet and mapping.  The standard servlet methods @GET, @PUT, @POST, @DELETE, and @HEAD are also included.  For creating a filter use the annotations @ServletFilter, and @FilterMapping.

There will be new asynchronous servlet support.  Proposed inclusions are “Comet-style” persistent connections from server to client (allows the server to push content to the client).  Also, there is support and events for suspending, resuming and timing out a servlet request.  On the response side, a servlet response can either be enabled or disabled.

In the realm of security, and still under discussion, is the ability to login and logout programatically.  Also, proposed is an HTTP-only cookie that would prevent many cross-site scripting vulnerabilities.

A number of ease of development

2 Responses
  1. yoR :

    Date: May 23, 2008 @ 7:43 am

    I’m personally not really fond of the annotations they are planning on putting in this spec. The annotations break a lot of programming ease, for example: code completion!

    When you ditch the interface and use a annotation to say something is a servlet you don’t have code-completion, nor typo-checking in the IDE. I think this is horrible and useless…

    My review, with more on my opinion can be found here:
    http://www.redcode.nl/blog16.html

  2. Devious Bard :

    Date: May 23, 2008 @ 8:19 am

    @YoR: You’re right. I take a lot of the stuff I see at JavaOne with a grain of salt. Many of the technologies are too new to know whether or not they will have any value in the “real world”. As far as the servlet 3.0 spec goes. I’ll need to wait and see.

Leave a Comment

Your comment

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.