chris monster wrote:
> apologies if i have missed a previous posting in my searches.
>
> in cross-testing our webapp between Tomcat 3.1 and another container
> (Resin 1.2.1) for compliance, i noticed that the behaviour of
> ServletContext.getRealPath() is different when applied to the
> application root. ( actually, after checking the 2.2 spec, i suspect
> this may not be well defined. )
>
> for getRealPath("/") AND getRealPath("")
>
> Tomcat 3.1 returns:
>
> realpath/
>
> whereas the other container returns:
>
> realpath
>
> (without the trailing path-separator)
>
> i'm coding around this difference right now, but i'm curious who i
> should be bugging about this. (get it, 'bugging'? ;)
>
Since this would be a spec interpretation issue, the best place to send
"bugging" messages would be to the spec feedback address printed on the front of
the servlet spec:
[EMAIL PROTECTED]
Tomcat (and every other container) should implement what the spec says. If the
spec is silent on a particular issue, then the appropriate thing to do would be
lobby for clarification in the next version -- which is timely now, because the
Servlet 2.3 spec is currently in "proposed final draft" stage, not "final".
>
> chris monster
>
Craig McClanahan
PS: As a side issue, I would encourage web app developers to start using
ServletContext.getResource() and ServletContext.getResourceAsStream(), instead
of ServletContext.getRealPath() followed by file I/O, to access internal
resources. The reason for this is that a servlet container is *not* required to
run your web app out of a filesystem (as Tomcat currently does) -- it may run
them directly from a JAR file, or in an environment like Oracle's where the web
app's resources are actually BLOB objects stored in a database, rather than
being accessible as files.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]