Hey again,

thanks for your replies. I just want to read the resource file and I tried
the getResource() method, it can't find the resource though. When I get the
absolute path of the context, I receive the file structure where the tomcat
is installed. But does tomcat internally have the same file structure? (i.e.
local tomcat installed on C:\progs\tomcat - ist it correct that tomcat
internally tries to retrieve the wanted file from C:\progs\tomcat\... ?)
I really tried a lot. I thought the problems arise because I have a
windows-tomcat the file structure uses the wrong slashes (so I tried using
"\\" instead of "/" - did not work). 
So to make it really clear:
1. i have a local tomcat installed on windows
2. i have an image deployed on that tomcat on
.../webapps/test/WEB-INF/graphics/test.gif

question: 
how can a deployed class on the server correctly read the image that resides
on the same server?

thanks again for your help and patience,
regards,
thorsten





David Smith-2 wrote:
> 
> This is per the spec which explicitly states that the method 
> getRealPath() will return null if the webapp is executed from an 
> unexpanded .war file.  I believe it's even in the docs for the servlet 
> api.  If however your effort is in just reading the resource, there are 
> other methods which work regardless of being in a .war file or not -- 
> getResource( path ) and getResourceAsStream( path ).
> 
> 
> --David
> 
> Mark Miller wrote:
>>> ,
>>> you could use ServletContext.getRealPath( ).  That will return the
>>> absolute path to the file, but only if the webapp isn't packed up as 
>>> .war.
>>>
>>> --David
>>>
>>>
>> Why is this the case? Doesn't Tomcat extract to war to a webapp/warname
>> folder when it first accesses it?
>>
>> - Mark
>>
> 
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/load-files-on-tomcat-tf2438873.html#a6877475
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to