tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tim Lucia" <timlu...@yahoo.com>
Subject RE: deploying myapp.war as "/" - confused
Date Fri, 19 May 2006 11:37:26 GMT
Use ServletContext.getResourse (returns a URL) or
ServletContext.getResourceAsStream (returns an InputStream).  These methods
will work for both expanded (directory) and non (war) deployments.

Tim


-----Original Message-----
From: Martin Grogan [mailto:mgrogan@keizensoftware.com] 
Sent: Friday, May 19, 2006 3:31 AM
To: Tomcat Users List
Subject: Re: deploying myapp.war as "/" - confused

Hello,
I'm not sure if I understand your question, but for finding files that 
are relative to the current context, I use
    ServletConfig config
    config.getServletContext().getRealPath(your_file_here)
Maybe that's not the correct way to be doing things??? But it works for me.
Martin


Nikita Tovstoles wrote:

>  Thanks - that was simpler than I thought. Follow up bonus question: 
> what's the new "current directory" of ServletContext? Here's what I mean:
>
> I had the following code in servlet context listener inside myapp.war 
> getting properties from a .properties file *outside* the .war:
>
> ServletContext.getResourceAsStream("../myapp.properties");
>
> This used to be my directory structure:
>
> $catalina.base/
>                webapps/myapp.war
>                webapps/myapp
>                webapps/myapp.properties
>
> Now that I'm deploying ROOT.war instead of myapp.war, the above line 
> can't find myapp.properties. Here's the current dir structure:
>
> $catalina.base/
>                webapps/ROOT.war
>                webapps/ROOT
>                webapps/myapp.properties
>
> So, when I was deploying myapp.war, ServletContext's "current dir" was 
> webapps/myapp. What's the new "current directory" of ServletContext 
> for ROOT application?
>
> thanks
> -nikita
>                    
> Mark Thomas wrote:
>
>> Nikita Tovstoles wrote:
>>
>>> Hi,
>>>
>>> I have myapp.war that I'd like to deploy by copying myapp.war to
>>> catalina.base/webapps; but I would like to bind the app to context "/".
>>
>>
>> Rename it to ROOT.war
>>
>> Mark
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>


-- 
------------
Martin Grogan
Keizen Software

mgrogan@keizensoftware.com
www.keizensoftware.com


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message