At 10:55 07/02/2001 +0100, you wrote:
>John Thorhauer wrote:
>
>>How can I access getRealPath() from outside of the services? Is there a
>>way to get the ServletConfig or the realpath from the ResourceService?
>
>I must say that I'm a bit sceptical about all that getRealPath
>commodities available (and planned).
>Servlet specifications states that ServletContext.getRealPath method
>might or might not work upon container's provider discretion.
>To be truly portale applications should access the files contained
>in their web applications archives/directories, they should use
>the following methods from ServletContext interface:
>
>java.net.URL getResource(String path) and
>java.io.InputStream getResourceAsStream(String path)
>
>where path is relative to webapplication root.
>
>I believe that ResourceService shold provide a wrapper to
>these methods (possibly also getRealPath, but this one
>should be deprecated).
I don't understand why ResourceService should provide these methods.
It's supposed to give access to configuration information not context
information.
It's cleaner to create a specific service for providing URL->path
resolution, or
more generally context services.
Also be aware that getResource() may have unexpected behavior depending
on your servlet runner, for example WebSphere returns "classpath:..."' URLs
when you use getResource().
--
Raphaël Luta - [EMAIL PROTECTED]
Vivendi Universal Networks - Services Manager / Paris
------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?: [EMAIL PROTECTED]