« May 2006 | Main | August 2006 »

June 2006 Archives

June 25, 2006

Porting from Tomcat to OC4J

When you start porting an application which contains Servlets watch out for lines using functions from the ServletContext class.

The methods getResource() and getResourceAsStream() take a path parameter. This path allows you to access files in your web application directory structure like "WEB-INF/config.xml".

Using these methods within Tomcat gives you a false sense of security as it silently allows path names without a starting "/". This is contrary to the J2EE API documentation which clearly states that "The path must begin with a "/" and is interpreted
as relative to the current context root.
"

OC4J very strictly follows the API documentation and specifications and therefore requires the starting "/".

Conclusion: Don't forget the starting "/" if you want to access files with the ServletContext class. It makes your life easier no matter which Servlet container you use.

About June 2006

This page contains all entries posted to Olaf Heimburger's Blog in June 2006. They are listed from oldest to newest.

May 2006 is the previous archive.

August 2006 is the next archive.

Many more can be found on the main index page or by looking through the archives.

Powered by
Movable Type and Oracle