Markus,
Im using Tomcat 5.5.17. I assumed that my browser would send the
If-Modified-Since Request-Header and have tried your jsp page and it
does.
What I am doing is serving images from a database.
Here is what I am doing in my spring controller...
protected ModelAndView handleRequestInternal(HttpServletRequest
httpServletRequest, HttpServletResponse httpServletResponse) throws
Exception
{
Enumeration headers = httpServletRequest.getHeaderNames();
while ( headers.hasMoreElements())
{
String header = (String)headers.nextElement();
System.out.println( header + " : " +
httpServletRequest.getHeader(header) );
}
final String url = httpServletRequest.getRequestURI();
final String imageName =
url.substring(url.lastIndexOf("/")+1).toLowerCase();
Long imageId = Long.parseLong(imageName.substring(0,
imageName.lastIndexOf(".")));
mIImageRepository.streamImage(imageId,
httpServletResponse.getOutputStream());
httpServletResponse.setDateHeader("Last-Modified", new
Date().getTime());
return null;
}
This is the output i get the first time the page is called...
host : 192.168.6.194:8080
user-agent : Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US;
rv:1.8.0.6) Gecko/20060728 Firefox/1.5.0.6
accept : image/png,*/*;q=0.5
accept-language : en-us,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
referer :
http://192.168.6.194:8080/catalog-1.0-SNAPSHOT/admin/editCategory.html?categoryId=1
cookie : JSESSIONID=AB7DD26B34FCAEA604B904B275C03BAD
And this is the output i get on the next call..
host : 192.168.6.194:8080
user-agent : Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US;
rv:1.8.0.6) Gecko/20060728 Firefox/1.5.0.6
accept : image/png,*/*;q=0.5
accept-language : en-us,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
referer :
http://192.168.6.194:8080/catalog-1.0-SNAPSHOT/admin/editCategory.html?categoryId=1
cookie : JSESSIONID=AB7DD26B34FCAEA604B904B275C03BAD
cache-control : max-age=0
Regards
Ben
On 9/5/06, Markus Schönhaber <[EMAIL PROTECTED]> wrote:
ben short wrote:
> I have tried with firefox and ie6. May i ask what you are using?
Firefox.
May I ask what you are using (i. e. Tomcat version)?
You didn't answer my question: Does your browser send an If-Modified-Since
Request-Header?
On Tomcat 5.5.17 calling this JSP *twice* will cause IE 6 and FF 1.5.0.6 to
send an If-Modified-Since header line on the second attempt. And the JSP will
display it.
---------- snip ----------
<[EMAIL PROTECTED] contentType="text/html"%>
<[EMAIL PROTECTED] pageEncoding="UTF-8" session="false" import="java.util.*"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Request Headers</title>
</head>
<body>
<h1>Request Headers</h1>
<table>
<tr>
<th>Header Name</th><th>Header Value</th>
</tr>
<%
response.addDateHeader("Last-Modified", new Date().getTime());
for(Enumeration headerNames = request.getHeaderNames();
headerNames.hasMoreElements();)
{
String headerName = (String) headerNames.nextElement();
String headerValue = request.getHeader(headerName);
%>
<tr>
<td><%= headerName %></td>
<td><%= headerValue %></td>
</tr>
<%
}
%>
</table>
</body>
</html>
---------- snap ----------
Regards
mks
---------------------------------------------------------------------
To start a new topic, e-mail: [email protected]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To start a new topic, e-mail: [email protected]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]