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: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to