RE: Patch to bug #345 complete ?
does any one have the bug # for the "304 Not Modified" bug of tomcat ? thanks, Henry -Original Message- From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]] Sent: Monday, August 20, 2001 11:35 AM To: [EMAIL PROTECTED] Subject: Re: Patch to bug #345 complete ? On Mon, 20 Aug 2001, Justin Erenkrantz wrote: > On Mon, Aug 20, 2001 at 10:54:43AM -0700, Craig R. McClanahan wrote: > > I'm not sure I would make quite so blanket a statement as that. If the > > servlet itself understands that the content it produces changes rarely, it > > can improve performance by respecting If-Modified-Since values. To make > > this worthwhile, though, it will also need to control the value sent for > > the "Last-Modified" header, which you can do by overriding the > > getLastModified() method of HttpServlet. > > True - you are correct. But, this wouldn't be something that Tomcat > could do by default - this would require that the servlet itself > handle this and have appropriate logic via getLastModified(). > The servlet can handle it, but that's user code not Tomcat code. Agreed. On my earlier statement, I should have pointed out that the automatic handling Tomcat 4 does is when serving static resources only. > -- justin > > Craig
Re: Patch to bug #345 complete ?
It looks like 3.3B1 already handles 304 (o.a.tomcat.modules.generators.StaticInterceptor). However, I haven't actually tested it (static files handled by Apache). - Original Message - From: "Craig R. McClanahan" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, August 20, 2001 11:13 AM Subject: RE: Patch to bug #345 complete ? > > > On Mon, 20 Aug 2001, Henry Yeh wrote: > > > > > where can we add code to actually compare the last modified > > and if-modified-since dates ? > > > > In Tomcat 4, it's inside the servlet that handles static files > (org.apache.catalina.servlets.DefaultServlet) -- I should have clarified > that my statement referred to serving static content only. > > For 3.x, you'd have to deal with it in the equivalent functionality (IIRC > it's in an interceptor in 3.2 and in a module in 3.3). > > Craig > > > > -Original Message- > > From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]] > > Sent: Monday, August 20, 2001 10:55 AM > > To: [EMAIL PROTECTED] > > Subject: Re: Patch to bug #345 complete ? > > > > > > On Mon, 20 Aug 2001, Justin Erenkrantz wrote: > > > > > On Mon, Aug 20, 2001 at 10:24:01AM -0700, Henry Yeh wrote: > > > > > > > > yes. I analyzed the HTTP header that's being sent and received by the > > > > browser. > > > > If-Modified-Since messages are sent to tomcat, and we are dealing with > > > > static files here (javascript and images). > > > > So is tomcat doesn't have the '304 behavior' for static files ? It does > > > > send back 'last-modified' date information in the header, and that > > ALWAYS > > > > matches the 'If-modified-since' date. Are we looking at another tomcat > > > > date bug here ? > > > > > > It's more of a feature that was never written. Tomcat has no code to > > > handle If-Modified-Since (based on a quick grep through the source > > > code - I could be wrong). You are welcome to write the code and apply > > > it locally. I'm not sure if it'll make it into the 3.x branch as I > > > think it is frozen. 4.x is a possibility for inclusion, however. (I > > > seem to remember that you are using 3.x.) > > > > > > However, you'll have to be aware that jsp's and servlets must ignore > > > If-Modified-Since headers so the implementation can be tricky. > > > > I'm not sure I would make quite so blanket a statement as that. If the > > servlet itself understands that the content it produces changes rarely, it > > can improve performance by respecting If-Modified-Since values. To make > > this worthwhile, though, it will also need to control the value sent for > > the "Last-Modified" header, which you can do by overriding the > > getLastModified() method of HttpServlet. > > > > > -- justin > > > > > > > > > > For what it's worth, Tomcat 4 stand-alone already correctly handles > > If-Modified-Since headers, and sends back "not modified" responses > > appropriately. > > > > > > Craig > > > >
Re: Patch to bug #345 complete ?
On Mon, 20 Aug 2001, Justin Erenkrantz wrote: > On Mon, Aug 20, 2001 at 10:54:43AM -0700, Craig R. McClanahan wrote: > > I'm not sure I would make quite so blanket a statement as that. If the > > servlet itself understands that the content it produces changes rarely, it > > can improve performance by respecting If-Modified-Since values. To make > > this worthwhile, though, it will also need to control the value sent for > > the "Last-Modified" header, which you can do by overriding the > > getLastModified() method of HttpServlet. > > True - you are correct. But, this wouldn't be something that Tomcat > could do by default - this would require that the servlet itself > handle this and have appropriate logic via getLastModified(). > The servlet can handle it, but that's user code not Tomcat code. Agreed. On my earlier statement, I should have pointed out that the automatic handling Tomcat 4 does is when serving static resources only. > -- justin > > Craig
RE: Patch to bug #345 complete ?
so this #345 bug fix which sends date in the header in the HTTP response. Is there any use to this date at all ? -Original Message- From: Justin Erenkrantz [mailto:[EMAIL PROTECTED]] Sent: Monday, August 20, 2001 11:27 AM To: [EMAIL PROTECTED] Subject: Re: Patch to bug #345 complete ? On Mon, Aug 20, 2001 at 10:54:43AM -0700, Craig R. McClanahan wrote: > I'm not sure I would make quite so blanket a statement as that. If the > servlet itself understands that the content it produces changes rarely, it > can improve performance by respecting If-Modified-Since values. To make > this worthwhile, though, it will also need to control the value sent for > the "Last-Modified" header, which you can do by overriding the > getLastModified() method of HttpServlet. True - you are correct. But, this wouldn't be something that Tomcat could do by default - this would require that the servlet itself handle this and have appropriate logic via getLastModified(). The servlet can handle it, but that's user code not Tomcat code. -- justin
Re: Patch to bug #345 complete ?
On Mon, Aug 20, 2001 at 10:54:43AM -0700, Craig R. McClanahan wrote: > I'm not sure I would make quite so blanket a statement as that. If the > servlet itself understands that the content it produces changes rarely, it > can improve performance by respecting If-Modified-Since values. To make > this worthwhile, though, it will also need to control the value sent for > the "Last-Modified" header, which you can do by overriding the > getLastModified() method of HttpServlet. True - you are correct. But, this wouldn't be something that Tomcat could do by default - this would require that the servlet itself handle this and have appropriate logic via getLastModified(). The servlet can handle it, but that's user code not Tomcat code. -- justin
RE: Patch to bug #345 complete ?
On Mon, 20 Aug 2001, Henry Yeh wrote: > > where can we add code to actually compare the last modified > and if-modified-since dates ? > In Tomcat 4, it's inside the servlet that handles static files (org.apache.catalina.servlets.DefaultServlet) -- I should have clarified that my statement referred to serving static content only. For 3.x, you'd have to deal with it in the equivalent functionality (IIRC it's in an interceptor in 3.2 and in a module in 3.3). Craig > -Original Message- > From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]] > Sent: Monday, August 20, 2001 10:55 AM > To: [EMAIL PROTECTED] > Subject: Re: Patch to bug #345 complete ? > > > On Mon, 20 Aug 2001, Justin Erenkrantz wrote: > > > On Mon, Aug 20, 2001 at 10:24:01AM -0700, Henry Yeh wrote: > > > > > > yes. I analyzed the HTTP header that's being sent and received by the > > > browser. > > > If-Modified-Since messages are sent to tomcat, and we are dealing with > > > static files here (javascript and images). > > > So is tomcat doesn't have the '304 behavior' for static files ? It does > > > send back 'last-modified' date information in the header, and that > ALWAYS > > > matches the 'If-modified-since' date. Are we looking at another tomcat > > > date bug here ? > > > > It's more of a feature that was never written. Tomcat has no code to > > handle If-Modified-Since (based on a quick grep through the source > > code - I could be wrong). You are welcome to write the code and apply > > it locally. I'm not sure if it'll make it into the 3.x branch as I > > think it is frozen. 4.x is a possibility for inclusion, however. (I > > seem to remember that you are using 3.x.) > > > > However, you'll have to be aware that jsp's and servlets must ignore > > If-Modified-Since headers so the implementation can be tricky. > > I'm not sure I would make quite so blanket a statement as that. If the > servlet itself understands that the content it produces changes rarely, it > can improve performance by respecting If-Modified-Since values. To make > this worthwhile, though, it will also need to control the value sent for > the "Last-Modified" header, which you can do by overriding the > getLastModified() method of HttpServlet. > > > -- justin > > > > > > For what it's worth, Tomcat 4 stand-alone already correctly handles > If-Modified-Since headers, and sends back "not modified" responses > appropriately. > > > Craig >
RE: Patch to bug #345 complete ?
where can we add code to actually compare the last modified and if-modified-since dates ? -Original Message- From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]] Sent: Monday, August 20, 2001 10:55 AM To: [EMAIL PROTECTED] Subject: Re: Patch to bug #345 complete ? On Mon, 20 Aug 2001, Justin Erenkrantz wrote: > On Mon, Aug 20, 2001 at 10:24:01AM -0700, Henry Yeh wrote: > > > > yes. I analyzed the HTTP header that's being sent and received by the > > browser. > > If-Modified-Since messages are sent to tomcat, and we are dealing with > > static files here (javascript and images). > > So is tomcat doesn't have the '304 behavior' for static files ? It does > > send back 'last-modified' date information in the header, and that ALWAYS > > matches the 'If-modified-since' date. Are we looking at another tomcat > > date bug here ? > > It's more of a feature that was never written. Tomcat has no code to > handle If-Modified-Since (based on a quick grep through the source > code - I could be wrong). You are welcome to write the code and apply > it locally. I'm not sure if it'll make it into the 3.x branch as I > think it is frozen. 4.x is a possibility for inclusion, however. (I > seem to remember that you are using 3.x.) > > However, you'll have to be aware that jsp's and servlets must ignore > If-Modified-Since headers so the implementation can be tricky. I'm not sure I would make quite so blanket a statement as that. If the servlet itself understands that the content it produces changes rarely, it can improve performance by respecting If-Modified-Since values. To make this worthwhile, though, it will also need to control the value sent for the "Last-Modified" header, which you can do by overriding the getLastModified() method of HttpServlet. > -- justin > > For what it's worth, Tomcat 4 stand-alone already correctly handles If-Modified-Since headers, and sends back "not modified" responses appropriately. Craig
Re: Patch to bug #345 complete ?
On Mon, 20 Aug 2001, Justin Erenkrantz wrote: > On Mon, Aug 20, 2001 at 10:24:01AM -0700, Henry Yeh wrote: > > > > yes. I analyzed the HTTP header that's being sent and received by the > > browser. > > If-Modified-Since messages are sent to tomcat, and we are dealing with > > static files here (javascript and images). > > So is tomcat doesn't have the '304 behavior' for static files ? It does > > send back 'last-modified' date information in the header, and that ALWAYS > > matches the 'If-modified-since' date. Are we looking at another tomcat > > date bug here ? > > It's more of a feature that was never written. Tomcat has no code to > handle If-Modified-Since (based on a quick grep through the source > code - I could be wrong). You are welcome to write the code and apply > it locally. I'm not sure if it'll make it into the 3.x branch as I > think it is frozen. 4.x is a possibility for inclusion, however. (I > seem to remember that you are using 3.x.) > > However, you'll have to be aware that jsp's and servlets must ignore > If-Modified-Since headers so the implementation can be tricky. I'm not sure I would make quite so blanket a statement as that. If the servlet itself understands that the content it produces changes rarely, it can improve performance by respecting If-Modified-Since values. To make this worthwhile, though, it will also need to control the value sent for the "Last-Modified" header, which you can do by overriding the getLastModified() method of HttpServlet. > -- justin > > For what it's worth, Tomcat 4 stand-alone already correctly handles If-Modified-Since headers, and sends back "not modified" responses appropriately. Craig
Re: Patch to bug #345 complete ?
On Mon, Aug 20, 2001 at 10:24:01AM -0700, Henry Yeh wrote: > > yes. I analyzed the HTTP header that's being sent and received by the > browser. > If-Modified-Since messages are sent to tomcat, and we are dealing with > static files here (javascript and images). > So is tomcat doesn't have the '304 behavior' for static files ? It does > send back 'last-modified' date information in the header, and that ALWAYS > matches the 'If-modified-since' date. Are we looking at another tomcat > date bug here ? It's more of a feature that was never written. Tomcat has no code to handle If-Modified-Since (based on a quick grep through the source code - I could be wrong). You are welcome to write the code and apply it locally. I'm not sure if it'll make it into the 3.x branch as I think it is frozen. 4.x is a possibility for inclusion, however. (I seem to remember that you are using 3.x.) However, you'll have to be aware that jsp's and servlets must ignore If-Modified-Since headers so the implementation can be tricky. -- justin
RE: Patch to bug #345 complete ?
yes. I analyzed the HTTP header that's being sent and received by the browser. If-Modified-Since messages are sent to tomcat, and we are dealing with static files here (javascript and images). So is tomcat doesn't have the '304 behavior' for static files ? It does send back 'last-modified' date information in the header, and that ALWAYS matches the 'If-modified-since' date. Are we looking at another tomcat date bug here ? thanks, Henry -Original Message- From: Justin Erenkrantz [mailto:[EMAIL PROTECTED]] Sent: Monday, August 20, 2001 10:11 AM To: [EMAIL PROTECTED] Subject: Re: Patch to bug #345 complete ? On Mon, Aug 20, 2001 at 09:18:53AM -0700, Henry Yeh wrote: > > I have noticed that after applying the patch the date is now > included in the tomcat HTTP response header, but it still > does not send back "not modified 304" if the file requested > hasn't been modified since the date specificed by the request ... > > anyone has any ideas on how to fix this ? thanks ! Are you sending If-Modified-Since? That doesn't look like it'd work in Tomcat. The 304 behavior doesn't apply to dynamic data as it is *always* regenerated. So, I'm not even sure if you'd want it. You definitely don't want to look at the date on the jsp file as that tells you nothing (unlike static content). Static content is a different story, but if you are serving static files from Tomcat, you probably want a real HTTP server in front of it. -- justin
Re: Patch to bug #345 complete ?
On Mon, Aug 20, 2001 at 09:18:53AM -0700, Henry Yeh wrote: > > I have noticed that after applying the patch the date is now > included in the tomcat HTTP response header, but it still > does not send back "not modified 304" if the file requested > hasn't been modified since the date specificed by the request ... > > anyone has any ideas on how to fix this ? thanks ! Are you sending If-Modified-Since? That doesn't look like it'd work in Tomcat. The 304 behavior doesn't apply to dynamic data as it is *always* regenerated. So, I'm not even sure if you'd want it. You definitely don't want to look at the date on the jsp file as that tells you nothing (unlike static content). Static content is a different story, but if you are serving static files from Tomcat, you probably want a real HTTP server in front of it. -- justin