tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier>
Subject Re: Logo file location
Date Mon, 14 Dec 2009 20:53:43 GMT
André Warnier wrote:
> David kerber wrote:
>> Caldarale, Charles R wrote:
>>>> From: David kerber []
>>>> Subject: Logo file location
>>>> In TC 5.5.x or 6.0.x, Where in my webapp folder structure should I put
>>>> a small .bmp file that I use for putting a logo on generated reports?
>>> Use ServletContext.getResourceAsStream() to retrieve the file, which 
>>> can be located pretty much wherever you want inside the webapp, even 
>>> under WEB-INF.
>> Will it find it pretty much wherever I put it,
> I don't think that this was what Chuck really meant above
>  or will I need to specify
>> the location?
> Yeah, it is not so smart. You have to give it a clue.
> It seems that you need to specify the path.
> But I guess you could set this path as an <init-param> in the web.xml of 
> your webapp.
Upon further examination of the spec page above, I would guess that a 
better way (more flexible) would be to specify the relative URI of your 
file as an <init-param> value, and then do a getRealPath() to convert 
that into a real path, and then call getResourceAsStream() to get a 
stream opened on it.
At least I presume that this is what they mean by "virtual path", in the 
getRealPath() explanation.

so, web.xml :

<webapp .......>

application :

    InputStream logo_stream = 

plus or minus some exception-catching stuff in case you messed up somewhere

and put your (readable) file in /webapps/mywebapp/logos/printlogo.jpg

Right, gurus ?

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message