Tuesday, February 7, 2012

Java Servlet Specification 3.0 - Quick Overview

What is a servlet?
A servlet is a JavaTM technology-based Web component, managed by a container,
that generates dynamic content. Like other Java technology-based components,
servlets are platform-independent Java classes that are compiled to platform-neutral
byte code that can be loaded dynamically into and run by a Java technology-enabled
Web server.

Java servlet technology is a widely accepted technology for creating dynamic java web applications. It is behind all modern java web frameworks. Following can be considered as the main focus of this release.
  1. Ease of development using Java annotations, 
  2. Asynchronous Servlet support 
  3. Pluggability and extendability of using fragments
  4. Security enhancements.
Annotations support has made the development easy. According to [1] it allows you to write a Servlet without requiring a descriptor. The web.xml may be user to override metadata specified via annotations.
@WebServlet and @WebFilter are the two main annotations for configuring the servlets and filters in Servlet 3.0. More details available at [1] and [2].

Asynchronous support (processing) is the biggest change made in the specification. According to [1] . it is introduced as a solution to following cases

  1. Waiting for a resource to become available, such as JDBC or a call to a Web Service.
  2. Generating response asynchronously
  3. Using exisiting frameworks to generate responses after waiting the for asychronous operation to complete.
assyncSupported attribute is used with @WebServlet and @WebFilter.

If this attribute is set to the true then the servlet or servlet filter spports the asynchronous processing and if this attribute is not used or is set to false then the servlet or servlet filter will not support the asynchronous process.


<web-fragment> is introduced in the servlet 3.0 specification and it has the ability to reduce the configuration

The following presentation will provide a great understanding about the new features of servlet 3.0 specification.

[1] http://java.dzone.com/articles/an-overview-servlet-30
[2] http://tejakantamneni.wordpress.com/2010/08/09/java-servlet-specification-3-0-overview-and-quick-intro/#comment-75




No comments:

Post a Comment

Using Zotero for academic writing