tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Abid Hussain" <abid.huss...@dilax.com>
Subject AW: Re: Ignore http header if-modified-since
Date Mon, 21 Dec 2009 13:54:01 GMT
Thanks a lot. I logged all header modifications using a filter and found 
the root cause.

It is a class called AbstractResourceProcessor from the Apache Shale 
framework. When requesting a resource which is actually located inside a 
jar, it sets the last-modified header using

java.text.SimpleDateFormat format = new SimpleDateFormat("EEE, dd MMM 
yyyy HH:mm:ss zzz");

without specifying any locale. This naturally results in a date 
formatted according to the server's locale.

So it seems I'll have to use a filter which converts the date back to 
the englisch locale format.

Best regards,

Abid 

> -----Ursprüngliche Nachricht-----
> Von: Len Popp [mailto:len.popp@gmail.com] 
> Gesendet: Freitag, 18. Dezember 2009 17:13
> An: Tomcat Users List
> Betreff: Re: Ignore http header if-modified-since
> 
> Add some debugging code to your app to find the point where 
> the Last-Modified header is added. Call 
> HttpServletResponse.containsHeader
> to see if the header has been set.
> --
> Len
> 
> 
> 
> On Fri, Dec 18, 2009 at 10:47, Abid Hussain 
> <abid.hussain@dilax.com> wrote:
> > OK, it seems that tomcat is working correctly.
> >
> > Still I would like to get the root cause of my problem 
> which is again:
> > The last-modified response header is delivered in the locale of the
> > server. E.g. if this locale is polish or germen, the header 
> is delivered
> > in polish resp. german format which is not correct and causes
> > misbehaviour.
> >
> > Naturally I just can set the locale to en_US to get the 
> desired header
> > format. But this is not the root cause of the problem. The 
> question is:
> > How can the format of this header can be set (or overridden) to the
> > server's locale?
> > I tried the following:
> > * Asked Google: Nothing found.
> > * Searched for occurences of "last-modified" in the source 
> code of my
> > application: Nothing found.
> > * Looked if the methods HttpServletResponse.setHeader() or
> > HttpServletResponse.addHeader() are used with the "last-modified"
> > somewhere in my application: Nothing found.
> > * Looked if one of the configured filters modify the header: Nothing
> > found.
> > * Looked if any valves are used: None.
> >
> > Anybody got an idea how I can investigate further?
> >
> > Regards,
> >
> > Abid
> >
> >> -----Ursprüngliche Nachricht-----
> >> Von: André Warnier [mailto:aw@ice-sa.com]
> >> Gesendet: Freitag, 18. Dezember 2009 13:56
> >> An: Tomcat Users List
> >> Betreff: Re: AW: Re: AW: RE: RE: Ignore http header 
> if-modified-since
> >>
> >> Mark Thomas wrote:
> >> > On 18/12/2009 09:36, André Warnier wrote:
> >> >> Christopher Schultz wrote:
> >> >>> -----BEGIN PGP SIGNED MESSAGE-----
> >> >>> Hash: SHA1
> >> >>>
> >> >>> Abid,
> >> >>>
> >> >>> On 12/17/2009 12:08 PM, Abid Hussain wrote:
> >> >>>> I used the startup parameters
> >> >>>> -Duser.language=en
> >> >>>> -Duser.region=US
> >> >>>> This caused Tomcat to deliver the Last-Modified in the
> >> correct format.
> >> >>>>
> >> >>>> That solved the problem, no 404 anymore, thanks.
> >> >>>> So it seems to be a bug in tomcat...?
> >> >>> I would say so.
> >> >>>
> >> >>> http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1
> >> >>>
> >> >>> Tomcat's behavior seems to ignore the specification,
> >> here. Would you
> >> >>> care to share your Tomcat version with us?
> >> >
> >> > So far, I haven't seen anything that demonstrates Tomcat is
> >> generating
> >> > this header. It looks like an app issue to me. My testing
> >> with trunk,
> >> > 6.0.x and 6.0.20 all show the correct format being used.
> >> >
> >> >> I think that once this is confirmed, it may be worth raising its
> >> >> visibility a bit for the Tomcat developers.
> >> >
> >> > As always before reporting an error, I'd highly recommend
> >> generating a
> >> > simple as possible test case that demonstrates the issue 
> on a clean
> >> > Tomcat install. I can't repeat this and at the moment it
> >> looks like an
> >> > application issue. Any bug report that can't be repeated is
> >> just going
> >> > to get closed as WORKSFORME.
> >> >
> >>
> >> For a confirmation of what Mark says above, I ran some tests.
> >>
> >> This Tomcat 5.5 is a pretty vanilla version, with just the
> >> standard example apps and not much more, on my Windows workstation.
> >> Versions are not the latest ones, I know.
> >>
> >> INFO: Starting Servlet Engine: Apache Tomcat/5.5.26 Platform
> >> : Windows XP, German Java :
> >> java version "1.6.0_06"
> >> Java(TM) SE Runtime Environment (build 1.6.0_06-b02) Java
> >> HotSpot(TM) Client VM (build 10.0-b22, mixed mode, sharing)
> >>
> >> Tomcat running as service, stopped and restarted before each
> >> test below
> >>
> >> A) Platform default
> >>   Tomcat startup parameters as per tomcat5w.exe :
> >> -Dcatalina.home=C:\Tomcat5.5
> >> -Dcatalina.base=C:\Tomcat5.5
> >> -Djava.endorsed.dirs=C:\Tomcat5.5\common\endorsed
> >> -Djava.io.tmpdir=C:\Tomcat5.5\temp
> >> -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
> >> 
> -Djava.util.logging.config.file=C:\Tomcat5.5\conf\logging.properties
> >>
> >> (platform default)
> >>
> >> Request:
> >> (Request-Line)        GET /RELEASE-NOTES.txt HTTP/1.1
> >> Host  localhost:8180
> >> User-Agent    Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB;
> >> rv:1.9.1.3)
> >> Gecko/20090824 Firefox/3.5.3
> >> Accept
> >> text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
> >> Accept-Language       en-gb,en;q=0.5
> >> Accept-Encoding       gzip,deflate
> >> Accept-Charset        ISO-8859-1,utf-8;q=0.7,*;q=0.7
> >> Keep-Alive    300
> >> Connection    keep-alive
> >> If-Modified-Since     Mon, 28 Jan 2008 20:38:54 GMT
> >> If-None-Match W/"7697-1201552734000"
> >> Cache-Control max-age=0
> >>
> >> Response:
> >> (Status-Line) HTTP/1.1 304 Not Modified
> >> Server        Apache-Coyote/1.1
> >> Etag  W/"7697-1201552734000"
> >> Date  Fri, 18 Dec 2009 11:37:58 GMT
> >>
> >> B) Adding explicit "DE" startup parameters
> >>   Tomcat startup parameters as per tomcat5w.exe :
> >> -Dcatalina.home=C:\Tomcat5.5
> >> -Dcatalina.base=C:\Tomcat5.5
> >> -Djava.endorsed.dirs=C:\Tomcat5.5\common\endorsed
> >> -Djava.io.tmpdir=C:\Tomcat5.5\temp
> >> -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
> >> 
> -Djava.util.logging.config.file=C:\Tomcat5.5\conf\logging.properties
> >> -Duser.language=de
> >> -Duser.region=DE
> >>
> >> Request :
> >> (Request-Line)        GET /RELEASE-NOTES.txt HTTP/1.1
> >> Host  localhost:8180
> >> User-Agent    Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB;
> >> rv:1.9.1.3)
> >> Gecko/20090824 Firefox/3.5.3
> >> Accept
> >> text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
> >> Accept-Language       en-gb,en;q=0.5
> >> Accept-Encoding       gzip,deflate
> >> Accept-Charset        ISO-8859-1,utf-8;q=0.7,*;q=0.7
> >> Keep-Alive    300
> >> Connection    keep-alive
> >> If-Modified-Since     Mon, 28 Jan 2008 20:38:54 GMT
> >> If-None-Match W/"7697-1201552734000"
> >> Cache-Control max-age=0
> >>
> >> Response :
> >> (Status-Line) HTTP/1.1 304 Not Modified
> >> Server        Apache-Coyote/1.1
> >> Etag  W/"7697-1201552734000"
> >> Date  Fri, 18 Dec 2009 11:26:01 GMT
> >>
> >>
> >> C) Adding explicit "FR" startup parameters
> >>   Tomcat startup parameters as per tomcat5w.exe :
> >> -Dcatalina.home=C:\Tomcat5.5
> >> -Dcatalina.base=C:\Tomcat5.5
> >> -Djava.endorsed.dirs=C:\Tomcat5.5\common\endorsed
> >> -Djava.io.tmpdir=C:\Tomcat5.5\temp
> >> -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
> >> 
> -Djava.util.logging.config.file=C:\Tomcat5.5\conf\logging.properties
> >> -Duser.language=fr
> >> -Duser.region=FR
> >>
> >> Request;
> >> (Request-Line)        GET /RELEASE-NOTES.txt HTTP/1.1
> >> Host  localhost:8180
> >> User-Agent    Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB;
> >> rv:1.9.1.3)
> >> Gecko/20090824 Firefox/3.5.3
> >> Accept
> >> text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
> >> Accept-Language       en-gb,en;q=0.5
> >> Accept-Encoding       gzip,deflate
> >> Accept-Charset        ISO-8859-1,utf-8;q=0.7,*;q=0.7
> >> Keep-Alive    300
> >> Connection    keep-alive
> >> If-Modified-Since     Mon, 28 Jan 2008 20:38:54 GMT
> >> If-None-Match W/"7697-1201552734000"
> >> Cache-Control max-age=0
> >>
> >> Response:
> >> (Status-Line) HTTP/1.1 304 Non Modifié
> >> Server        Apache-Coyote/1.1
> >> Etag  W/"7697-1201552734000"
> >> Date  Fri, 18 Dec 2009 11:34:13 GMT
> >>
> >>
> >> In other words, changing the
> >> -Duser.language=xx
> >> -Duser.region=xx
> >> Java command-line parameters don't seem to make a difference
> >> in the headers returned by Tomcat, and these headers do not
> >> seem to include an "Last-Modified" header.
> >> If you look closely at the 3d example above however, you'll
> >> see that the HTTP status line, in the French case, /is/
> >> modified compared to the default. So Tomcat definitely is
> >> sensitive to the JVM language setting for some things.
> >>
> >> Finally, I added a test with a new file, to see if I could
> >> obtain the Last-Modified header somehow :
> >>
> >> D) still French settings
> >>   Tomcat startup parameters as per tomcat5w.exe :
> >> -Dcatalina.home=C:\Tomcat5.5
> >> -Dcatalina.base=C:\Tomcat5.5
> >> -Djava.endorsed.dirs=C:\Tomcat5.5\common\endorsed
> >> -Djava.io.tmpdir=C:\Tomcat5.5\temp
> >> -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
> >> 
> -Djava.util.logging.config.file=C:\Tomcat5.5\conf\logging.properties
> >> -Duser.language=fr
> >> -Duser.region=FR
> >>
> >> Request:
> >> (Request-Line)        GET /RELEASE-NOTES_updated.txt HTTP/1.1
> >> Host  localhost:8180
> >> User-Agent    Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB;
> >> rv:1.9.1.3)
> >> Gecko/20090824 Firefox/3.5.3
> >> Accept
> >> text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
> >> Accept-Language       en-gb,en;q=0.5
> >> Accept-Encoding       gzip,deflate
> >> Accept-Charset        ISO-8859-1,utf-8;q=0.7,*;q=0.7
> >> Keep-Alive    300
> >> Connection    keep-alive
> >>
> >>
> >> Response:
> >> (Status-Line) HTTP/1.1 200 OK
> >> Server        Apache-Coyote/1.1
> >> Etag  W/"7697-1201552734000"
> >> Last-Modified Mon, 28 Jan 2008 20:38:54 GMT
> >> Content-Type  text/plain
> >> Content-Length        7697
> >> Date  Fri, 18 Dec 2009 11:47:39 GMT
> >>
> >> This time (1st request for a new document), I did get a
> >> "Last-Modified"
> >> header, but despite the French setting, it is definitely an
> >> English Last-Modified date.
> >>
> >> It seems that in some cases, the Last-Modified header /is/
> >> being generated by Tomcat, but it is always the "en" version.
> >>
> >> Hope this helps
> >>
> >>
> >> 
> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> >> For additional commands, e-mail: users-help@tomcat.apache.org
> >>
> >>
> >>
> >
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message