cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefano Mazzocchi <stef...@apache.org>
Subject Re: WAR file
Date Sat, 03 Jun 2000 12:16:13 GMT
David Duddleston wrote:
> 
> > > First I think we have to make Cocoon 2 use the Context.getRealPath()
> > > everywhere a resource is allocated.
> >
> > we should try to use getResource() and no real paths at all.
> 
> I guess it is a matter of what needs to be accomplished.
> 
> File file = new File(context.getRealPath("/WEB-INF/cocoon.xcof"));
> 
> InputStream in = new URL(
>         context.getResource("/WEB-INF/cocoon.xcof""))
>         .openStream(); // or something like this
> 
> getRealPath returns a String
> Z:\tomcat\webapps\tomcat\web-inf\cocoon\WEB-INF\cocoon.xconf
> 
> getResource returns a URL
> file:Z:\tomcat\webapps\tomcat/cocoon/web-inf/cocoon.xconf
> 
> getResource is the most flexible but getRealPath should work just fine in
> most cases.
> 
> What do you think.

getResource() works always (i.e. even if your servlet engine is
clustered and the actual file doesn't reside on the disk), getRealPath()
doesn't.

Sure, tomcat doesn't make use of clustered enviornments very well, but
this may not be the case in the future.

Just consider this when you evaluate the two.

(I myself proposed to deprecate getRealPath() in the servlet expert
group but got rejected)

-- 
Stefano Mazzocchi      One must still have chaos in oneself to be
                          able to give birth to a dancing star.
<stefano@apache.org>                             Friedrich Nietzsche
--------------------------------------------------------------------
 Missed us in Orlando? Make it up with ApacheCON Europe in London!
------------------------- http://ApacheCon.Com ---------------------



Mime
View raw message