cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Philippe Lavoie <philippe.lav...@cactus.ca>
Subject RE: [Bugfix] Relative path problem under JRun
Date Wed, 19 Jan 2000 14:45:01 GMT
> Stefano Mazzocchi wrote:
> > 
> > > !           return ((request.getPathInfo() == null)
> > > !               ? request.getRealPath(request.getRequestURI())
> > > !               : request.getPathTranslated()).replace('\\','/');
> > > !          } catch (MalformedURLException e) {
> > >               throw new RuntimeException("Malformed 

> > >               // if there is no such method we must be in 
> Servlet API 2.1
> > > !             if (request.getPathInfo() != null) {
> > > !                 // this must be Apache JServ
> > > !                 return 
> request.getPathTranslated().replace('\\','/');
> > > !             } else {
> > > !                 // otherwise use the deprecated method 
> on all other
> > > servlet engines.
> > > !                 return 
> request.getRealPath(request.getRequestURI());
> 
> > I'm probably missing something but this patch is totally equivalent.
> > 
> 
> No. replace() is not called on the result of getRealPath() in 
> the patched
> version.
> 


The first part is 


((request.getPathInfo() == null)
             ? request.getRealPath(request.getRequestURI())
              : request.getPathTranslated())

Then that result string goes through .replace('\\','/');	


So the 1.6 version is missing a replace for the == null case.


Took me a while, to find out what 1.5 was doing right. Basically
the way it is formated makes that piece of code a bit misleading.
But it is very concise :)

Phil

Mime
View raw message