Hello  John

Actually, this is possible: I have done it like this:

<Context path="/myWebAppContextName/images"
         docBase="/usr/myPhotos/Thumbs"
         crossContext="false"
         debug="0"
         reloadable="true" >
</Context>

which goes into tomcat/conf/Catalina/host/myThumbs.xml

Then, when the html generated by myWebAppcontextName/myServlet
contains something like

src="images/thumb123.jpg"

what tomcat sees is

http://www.yourDomain.com/myWebAppContextName/images/thumb123.jpg

but the myThumbs.xml trumps the definition of the context in the
above URL and will be simply seen by the tomcat DefaultServlet as a reference to the actual location on disk.
(i.e., "myWebAppContextName/images" is replaced by
"/usr/myPhotos/Thumbs") and tomcat will serve it from there if
the /usr/myPhotos/Thumbs tree is readable by tomcat.

The problem, however, is that you had better turn off  directories
listing in the conf/web.xml for DefaultServlet:

        <init-param>
            <param-name>listings</param-name>
            <param-value>false</param-value>
        </init-param>

and/or put a blank index.html in all directories in the image
tree, or anyone can look at the image tree.  Tomcat, however, is
real good about not letting anyone see above the /usr/myPhotos/Thumbs
level.

Maurice Yarrow


John Laughton wrote:
The problem with the servlet is sandboxing
If you try to refer (href) to a file outside the container, it will not work
Chuck,
I want to have a jsp page with lots of jpeg's. In order to keep them in the container, I would need to put them into the war file. This would make the war file huge !

The other option is to put a softlink in the war file to point to another area of disk outside the container (I am linux based)
I had problems getting this to work properly

I ended up creating a new context with
.../tomcat/conf/Catalina/localhost/imageData.xml

and put my jpegs there

Now I can put the following in my jsp file
  <td>
  <a href="/imageData/alex/busc/game07/DSC_1981.jpg">
<img alt="thumb image" src="/imageData/alex/busc/game07/DSC_1981_thumb.jpg"/></a>
  </td>

when the browser gets to the img statement, it actually pulls the thumbnail from a different context

John

At 12:39 PM 10/27/2005 -0500, Caldarale, Charles R wrote:

> From: John Laughton [mailto:[EMAIL PROTECTED]
> Subject: Re: static server implementation?
>
> I ended up created a second context in tomcat that allows
> access to the static content (ie. large jpegs)

I'm confused.  Why wasn't Tomcat's default servlet sufficient?  It's
sole purpose is to deliver static content.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


**********************************************************************
  John Laughton, Cisco Systems            ([EMAIL PROTECTED])
  408.902.3592 (voicemail and fax)       page - 1 800 365 4578
**********************************************************************




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to