The Source for Java Technology Collaboration
User: Password:



Greg Murray

Greg Murray's Blog

Servlets Updated

Posted by gmurray71 on February 27, 2006 at 11:55 AM | Comments (3)

Servlets sit at bottom end of the API stack for web developers using Java technologies. If you have used JSP, JSF, Struts, Web Work, Velocity, or any of the other frameworks out there you have more than likely used the Servlet API.

What do I like about the Servlet API? As a developer I like being as close to possible to HTTP as possible and Servlets lets me do that well. The Servlet API has adapted to fit the needs of scripting languages by being the base for JSP, re-usable component models such as JSF, frameworks like Struts, and Portlets. Servlets are even good for providing the server side processing for AJAX clients.

So what big changes were made in Servlet 2.5?
  • ServletContext.getContextPath() - Ever wonder what the context root was for your web application? This API is a long need addition.
  • Annotations - Added annotations for Java persistence, web service, declaring roles, run as, and EJBs. We did not add annotations for decarling servlets, filters, and listeners in this release though this will be a topic of discussion in the next servlet release.
  • Resource Injection - Resource injection is a way of injecting references of container managed resources such as data sources, environment entries, or web services into container managed components such as servlets, filters and listeners. Support for resource injection was added for Java Enterprise Edition containers.
  • web.xml Changes- Removed the need to have a web.xml in web applications without servlets, filters or listeners. Some conveniences for declaring components in the web.xml were added.

Jason Hunter, a long time member of the Servlet EG, has detailed the changes in the article New features added to Servlet 2.5 on Java World.

Download the updated Servlet 2.5 specification from here.

If you want to try out the Servlet 2.5 features today the Glassfish container provided by Sun just released a beta containing support for the new changes.

If you would like to see some of the things we are thinking about for the next servlet release, or if you would like to propose an addition please see my blog entry titled Got Servlets.


Bookmark blog post: del.icio.us del.icio.us Digg Digg DZone DZone Furl Furl Reddit Reddit
Comments
Comments are listed in date ascending order (oldest first) | Post Comment

  • First major miss from 2.5 : a standard way to integrate container authentication back into the application code.

    Most Java EE applications have dumped the container base authentication and replaced this by an application AA because there is no standard way to integrate the container with any "application managed" logic.

    Second other miss from 2.5 : not having pattern using regular expression ! I do not understand why ? I mean, why o who are we will stick with "*" only ?.

    Third one missing from 2.5 is a consequence of the second, the support in servlet of "business oriented" pathinfo is poor, hence creation of "crawler friendly" URL is too complex and result in bad indexation of Servlet implemented sites (as a example, you would have less hit on google using blojsom than using blog like dorclear).

    Forth one, enhance welcome file to support virtual alias (names that are not real files but that will be catch by an filter or a servlet with a mapping).This is required to have default JSF views like index.jsf for instance ! At this time it is not possible in JSF to have default view for the "folders". This is not URL/Web friendly at all.

    Last one, but a more minor one : no support for "listener config" (tells on which port to listen, for what protocol and which host) and non-http servlet (what if I want to implement another request-response based protocol that is not HTTP?)...

    Well this leaves a lot of room for major improvement isn't it ?

    IMHO, 2.5 is nice but it is very very far from the expectation, because it is 98% only following the EJB3.0 requirements as some "side effect" and not bringing any real improvment !

    Guys Servlet has done a lot, but it is improving slowly now if you compare to other API, we need Servlet to improve as fast as other Java components or it will lower the impact of Java EE 5 when the final spec will be pushed !
    All of us what strong Java EE isn't it ? So, take serious decisions now, it is still time to introduce new features IMHO (as long as it has limited impact to existing one).

    Posted by: bjb on February 28, 2006 at 03:35 PM


  • I would have loved to find a standard way to have pluggable authentication code into a servlet container but this is not a simple task. It was decided early on to not make Servlet 2.5 a major refresh in this release as other parts of the web tier and platform needed changes.

    Regular expression matching would also be great but it's not as simple when you think of how it might effect security constraints and the ordering for example. It is something that would be a good addition.

    It is very easy to make demands of an EG but you also must understand that there are many existing products involved and changing even the simple wording on some things can be very difficult as there are also many dependent APIs that must be considered.


    Slow change is not necessarily a bad thing. Another question you might ask is "do we go back to the drawing board and re-design servlets or do we continue wiring in new features?"

    Posted by: gmurray71 on February 28, 2006 at 05:44 PM

  • I think bjb's hit on a lot of sore spots. I've never met a developer who hasn't wanted full regular expressions, for example. I think items are these should be first tier considerations for the next revision.

    In general, alot of web Java ends up re-creating alot of the functionality that belongs in the Servlet domain. I suggest the expert group start by looking hard at the popular web frameworks for new directions to take the specification.

    Posted by: ilazarte on February 28, 2006 at 09:38 PM



Only logged in users may post comments. Login Here.


Powered by
Movable Type 3.01D
 Feed java.net RSS Feeds