Please browse the categories below to previous answers to questions like yours. If you do not find the answer for your particular situation, ask for help on the appropriate mailing list.
(Answer) (Category) Java Apache Project : (Category) Apache JServ 1.0 : (Category) Programming and Misc. Tidbits :
getDateHeader("If-Modified-Since") always returns -1


----------
From: Robert Chou rob_chou@bigfoot.com
To: "'java-apache-users@list.working-dogs.com'"  java-apache-users@list.working-dogs.com
Subject: getDateHeader("If-Modified-Since") always returns -1
Date: Wed, Jul 21, 1999, 8:49 PM


hi All,

I'm running Apache 1.3.6 and JServ 1.0b5 under Windows NT 4.0
and have noticed the following servlet behavior:

1. getHeader("If-Modified-Since") always returns null.
2. getDateHeader("If-Modified-Since") always returns -1.

I did a clean install of apache, jserv, and gnujsp 0.9.10 on a new machine and sent
the following request:

GET /webbuilder/snoop.jsp HTTP/1.0
Host: localhost2
If-Modified-Since: Sun, 06 Nov 1998 08:49:37 GMT
If-Modified-Since2: Sun, 06 Nov 1998 08:49:37 GMT

snoop.jsp is a sample jsp file included with gnujsp which happens to dumps headers.
For some strange reason, "Host" and "If-Modified-Since2" is printed, but not
"If-Modified-Since".  I then wrote a servlet to output this header with no luck.
getHeader always returns null.  I then sent the above request to a static html
file and got a 304, which seems to show that apache got it, at least.

Looking at the source, I found a line in apache which unset "If-Modified-Since",
but nothing else interesting (although my first time looking at the code, 
so no guru).

Anyone have seen this before?
thanks,
rob
----------
From: Henner Zeller zeller@stud.fh-heilbronn.de
To: Java Apache Users java-apache-users@list.working-dogs.com
Subject: Re: getDateHeader("If-Modified-Since") always returns -1
Date: Thu, Jul 22, 1999, 3:37 AM


The 'If-Modified-Since' header is evalutated by Apache itself and thus
your servlets do not get it. 

Basically, if Apache gets a request like this, it invokes the 
'long getLastModified()' - method of your servlet which must return the 
milliseconds since 1970 when the content (which would be generated) has 
last changed and invokes the doGet()/doPost() method only if the content
is newer. The default implementation of getLastModified() always returns a
value which requires to call do[Get/Post](). 

You find a longer descripton of this
behaviour at Jason Hunters Book pp 67,68

ciao,
  -hen
---
Henner Zeller                                 zeller@fh-heilbronn.de
 PGP pub key [77F75B39]: finger zeller@lemming.stud.fh-heilbronn.de 

 If Microsoft is the answer, it must have been a VERY silly question.
[Append to This Answer]
Previous: (Answer) How do I debug my servlets?
Next: (Answer) How do I redirect the ServletOutputStream?
This document is: http://java.apache.org/faq/?file=259
[Search] [Appearance] [Show Expert Edit Commands]
This is a Faq-O-Matic 2.709.
Please browse the categories below to previous answers to questions like yours. If you do not find the answer for your particular situation, ask for help on the appropriate mailing list.