On Wed, 7 Feb 2001, Rafal Krzewski 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).
What one should be deprecated?
I've made a couple of changes now that work like
the following:
TurbineResources.getServletConfig();
TurbineResources.getRealPath();
I simply want to provide an easy way for all classes
to have access to the webapp path, I'm not very
particular on how they are implemented. I've made
these changes and am using them in Tambora. I discussed
this briefly with Jon but this is the first posting
to the list.
Even though the Servlet spec says the container doesn't
have to provide a getRealPath() how many of them do?
My particular requirement is the uploading of files
into a location in the webapp. So I need to create
files within the webapp. Rafal, if I can do that
with the method you outline then I am cool with that,
but I think providing easy access to the webapp.
Can we figure this out quickly, I don't think this
is a very difficult thing. I would like to see this
in the resource service. It may not be 100% appropriate
but I don't think this requires a separate service.
Rafal, I can send you the changes you made if you
want to look them over, or I can dump them in
a whiteboard directory if anyone else is interested
in looking at them.
jvz.
------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?: [EMAIL PROTECTED]