You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Daniel Yawitz <da...@yawitz.com> on 2001/04/26 22:08:43 UTC

are flat files served by Tomcat when forwarded?

When Tomcat is integrated w/Apache, what happens when a JSP/servlet forwards a request to a static file (HTML page, image,...)?  Who serves it, Tomcat or Apache?  

ex:
String newloc = "images/biscuit.jpg";
getServletContext().getRequestDispatcher(newloc).forward(request, response);

thanks,
dan


Re: are flat files served by Tomcat when forwarded?

Posted by Daniel Yawitz <da...@yawitz.com>.
Does the situation you describe count as Tomcat serving the file?  Does
Tomcat actually feed the file to Apache thru the ajp port or just send
Apache the new url?

All the Tomcat docs strongly suggest Apache integration for the purpose of
faster flat-file serving.  I'm worried that my method of forwarding image
requests from a "getImage" servlet is actually serving the image from
Tomcat, not Apache...  You mentioned the httpd.conf mount directives.  The
request for the "getMedia" servlet is obviously delegated to Tomcat, but
what about when this servlet forwards to an image?  Does Apache recognize
this and take over from there, serving the image?  Or does Tomcat hide the
forward from Apache and send back the image data to Apache as the initial
servlet request?

If the image file *is* being served by Tomcat in one sense or another, is
there any way to have Apache do it w/o sending a redirect back to the
client?

thanks for the help,
dan


----- Original Message -----
From: "Steve Ruby" <st...@rubysolutions.com>
To: <to...@jakarta.apache.org>
Sent: Thursday, April 26, 2001 2:47 PM
Subject: Re: are flat files served by Tomcat when forwarded?


> > Daniel Yawitz wrote:
> >
> > When Tomcat is integrated w/Apache, what happens when a JSP/servlet
forwards a request to a static file (HTML page,
> > image,...)?  Who serves it, Tomcat or Apache?
> >
> > ex:
> > String newloc = "images/biscuit.jpg";
> > getServletContext().getRequestDispatcher(newloc).forward(request,
response);
> >
> > thanks,
> > dan
> >
>
> Apache gets Tomcat to process the request which returns the information
> to apache and then is sent to the client.
>
> When you are using apache+tomcat for your web traffic may be on port
> 80 for example, only Apache can serve port 80 requests, tomcat is serving
> apj requests back to Apache when the request matches some Mount directive.


Re: are flat files served by Tomcat when forwarded?

Posted by Steve Ruby <st...@rubysolutions.com>.
> Daniel Yawitz wrote:
> 
> When Tomcat is integrated w/Apache, what happens when a JSP/servlet forwards a request to a static file (HTML page,
> image,...)?  Who serves it, Tomcat or Apache?
> 
> ex:
> String newloc = "images/biscuit.jpg";
> getServletContext().getRequestDispatcher(newloc).forward(request, response);
> 
> thanks,
> dan
> 

Apache gets Tomcat to process the request which returns the information
to apache and then is sent to the client.

When you are using apache+tomcat for your web traffic may be on port
80 for example, only Apache can serve port 80 requests, tomcat is serving
apj requests back to Apache when the request matches some Mount directive.