You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Manolito Snell <Ma...@citydisc.com> on 2001/07/11 17:02:58 UTC

"Last-Modified" header set in servlet responds as installation da te of Apache.

Hi all,
When calling a servlet in Tomcat via Apache, the "Last-Modified" header is
always set to the same time. The time set is EXACTLY the same as the
installation date of Apache (coincident?).

While calling the servlet directly in Tomcat, the "Last-Modified" header is
set as done in the MyServlet.doGet() method with for example:
	1 - response.setDateHeader( "Last-Modified", 0L );
	2 - response.setHeader( "Last-Modified", "Thu Jan 01 01:00:00 GMT
1970" );
	3 - overriding MyServlet.getLastModified() with: return 0L;
Above methods tried, al worked fine in a direct call to Tomcat.
While using none off the above, Apache/Tomcat or Tomcat both didn't return a
"Last-Modified" header ( as they should be :) ). 
Below this page I've included an example of my request-response outcomes.

This is really annoying. Needless to say, I can't use the
"If-Modified-Since" Request header to determine if I've to recreate the
response content or send a 304 (Not Modified) status.
Anybody any ideas?
Regards Manolito.

.
.
.
.
.
.
.
/**** RESPONSE/REQUEST EXAMPLE ***/
For the Apache/Tomcat I used http://localhost:80 and for direct Tomcat is
used http://localhost:8080
Using the following Request header:
	GET /servlet/getImage?id={715EF564-2B45-11D5-9AF4-080009EEFA50}
HTTP/1.1
	Accept: */*
	Accept-Language: nl,en-us;q=0.5
	Accept-Encoding: gzip, deflate
	User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)
	Host: localhost:80
	Connection: Keep-Alive

The Response header from calling directly at Tomcat is:
	HTTP/1.0 200 OK
	Content-Type: image/gif
	Content-Disposition:  inline;
filename="ic_map_description_40.gif";creation-date="Wed, 7 Feb 2001 16:29:51
GMT";
	Last-Modified: Thu, 01 Jan 1970 00:00:00 GMT
	Servlet-Engine: Tomcat Web Server/3.2.2 (JSP 1.1; Servlet 2.2; Java
1.2.2; Windows NT 5.0 x86; 	java.vendor=Sun Microsystems Inc.)
********** Notice the Last-Modified field, it's OK!!!!

The Response header from Apache/Tomcat is:
	HTTP/1.1 200 OK
	Date: Wed, 11 Jul 2001 14:27:37 GMT
	Server: Apache/1.3.20 (Win32) mod_jk
	Content-Disposition: inline;
filename="ic_map_description_40.gif";creation-date="Wed, 7 Feb 2001 16:29:51
GMT";
	Last-Modified: Tue, 10 Jul 2001 08:29:49 GMT
	Servlet-Engine: Tomcat Web Server/3.2.2 (JSP 1.1; Servlet 2.2; Java
1.2.2; Windows NT 5.0 x86; java.vendor=Sun Microsystems Inc.)
	Keep-Alive: timeout=15, max=100
	Connection: Keep-Alive
	Transfer-Encoding: chunked
	Content-Type: image/gif
********** Notice the Last-Modified field, it's my installation date of
Apache!!!!