Idea for new Servlet spec
Some weeks ago Greg Murray wanted ideas for the next version of the servlet spec. I had an idea that would really help with working with many frameworks.
Originally J2EE was designed with componentization at a WAR and EJB-JAR file level. I think the idea was that you'd get a set of WAR and EJB-JAR files bundle them up in an EAR and poof! Radical new web-app. I'm sure someone will correct me and tell me that wasn't the plan, but that's certainly the way is looks to me right now.
What has happened is that things have been componentized at a more granular level. For example Spring contributes an OpenSessionInViewFilter, DWR contributes an Ajax servlet, Struts, Webwork, etc contribute controller servlets. All of these come with instructions about a whole set of incantations to put into your WEB-INF/web.xml
file.
So the solution is simple - We need a new element like this:
<include src="WEB-INF/lib/dwr.jar!ajax.xml"/>
This would allow web frameworks and libraries to export a set of web.xml insert files. And you could make use of some functionality with a single line.
It might be a good idea to have a <param...>
mechanism to allow you to customize the action of the web.xml insert file.
Benefits
- Less typing, and less cut and paste errors.
- Clearer demarcation about what does what in your web.xml file.
- Much simpler web.xml files, you only need to define what you have written, and just link to the stuff you are re-using.
- The ability to have several different configs and switch between them without getting lost in comments. This is particularly good for altering security settings.
What do you think?
Technorati tags: servlet
Comments
Comments have been turned off on old posts