On Wed, Feb 07, 2001 at 12:17:48PM +0100, Raphaël Luta wrote:
> >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).

You're absolutely right Rafal (surprisingly :-) ) - files should be
accessed through these methods (it's the only way for this to work on
containers that don't unpack WAR files). 

There should also be a deprecated getRealPath as well though, in case it
is needed where a URL or stream won't do.

> 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.

I can see what you're getting at, but a broader interpretation of
ResourceService could be that it provides global resources to the
application. Currently this is in the form of properties, but there is
no reason not to extend that to file-based resources, keyed by path from
the webapp root.

-- 
Sean Legassick
[EMAIL PROTECTED]
      Als Mensch kann mir nichts menschliches Fremd sein  
      
      


------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?:           [EMAIL PROTECTED]

Reply via email to