cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vadim Gritsenko <vadim.gritse...@verizon.net>
Subject Re: [WEB-INF] MicroStep #1: getRealPath()
Date Fri, 31 Jan 2003 16:38:02 GMT
Pier Fumagalli wrote:

>I see quite extensively throughout the code, the use of "getRealPath"... In
>my book, this is always true:
>
>new URL("file:" + getRealPath(x)).equals(getResource(x));
>
>Unless I overlooked something. I don't quite remember why it wasn't
>deprecated in Servlet 2.3, but definitely, to me, it doesn't make much
>sense.
>
>What if as microstep #1 we deprecated getRealPath() in favor of
>getResource(), and went around in the entire code-base replacing and fixing
>stuff?
>
>Then in the getRealPath() call in both CommandlineContext and HttpContext
>should become something like
>
>public string getRealPath(String path) {
>    URL url = getResource(path);
>    if ("file".equals(url.getProtocol()) {
>        return new File(url.getPath()).absolutePath()
>    }
>    return(null);
>}
>
>And would be deprecated... Is there something I _massively_ overlooked?
>  
>

javac works only with files, resource just won't cut it. Some other 
places also need file instead of resource.

BTW, I recently greped source for WEB-INF and found that there are 
several places wich trying to find file. I propose to move this code 
into one place, say, CocoonServlet and Main, and save context file path 
into Context attribute - thus we can remove these calculations from 
other places.

wdyt?

Vadim


>    Pier
>  
>



---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Mime
View raw message