This stuff is getting *really* funny! I run it under Windows and it worked.
I compared HTTP headers, the problem is that:
- Apache (under Windows or Linux) does not set "Expires" header for HTML
pages restituted by Tomcat
- Apache _under Linux_ sets a wrong (i.e. old, not updated) "Last-Modified"
header, so that the browser loads a local cached copy of the page
The time set by Apache into the "Last-Modified" header is not the time of
creation/modification of any other file of my webapps/test directory, so I
really can't understand how Apache sets it.
Any hint?
Cheers,
Michele
> -----Original Message-----
> From: Michele Milani
> Sent: luned� 10 dicembre 2001 12:14
> To: '[EMAIL PROTECTED]'
> Subject: Apache + mod_jk (ajp13) + Tomcat: no "Expires" header in the
> response
>
>
> Dear guys,
>
> I searched the archive and the Usenet without success.
>
> I'm using a box with:
>
> - Linux Red Hat 7.2
> - Apache 1.3.20
> - mod_jk (ajp13)
> - Tomcat 3.3
>
> I developed a web application that let you browse through
> some static HTML pages and let you update the content of
> these HTML page, inserting some data in a form.
>
> The update of the static pages is done by a servlet that
> rewrite the HTML file. The problem is that I can't get the
> last updated HTML page in my browser.
>
> I thought it was a problem realted to caching, so I forced
> Apache to set the "Expires" header writing in the httpd.conf:
>
> #ExpiresActive On
> #ExpiresByType text/html "access"
>
> but this solution didn't help.
>
> I turned on a protocol analyzer (Etheral) to try and
> understand what the problem was and I realized that Apache
> does not set the "Expires" header when the HTML page comes
> from Tomcat.
>
> I think my application is not so strange: I want to save the
> new data inserted by the user so that the next time she
> requests the page she gets the last version of it.
>
> I wrote another very simple application to explain my problem
> better, simply copy the following files under
> $TOMCAT_HOME/webapps/ and compile the servlet:
>
> ===============
> test/index.html
> ===============
> <html>
> <head>
> </head>
> <body>
> <a href="servlet/DateServlet">Test</a><br>
> </body>
> </html>
>
> =====================================
> test/WEB-INF/classes/DateServlet.java
> =====================================
> import java.io.*;
> import java.util.*;
> import javax.servlet.*;
> import javax.servlet.http.*;
>
> public class DateServlet extends HttpServlet {
>
> public void doGet(HttpServletRequest request,
> HttpServletResponse response) throws IOException, ServletException {
> try {
> Date now = new Date();
>
> PrintWriter dateWriter = new
> PrintWriter(new FileWriter("../webapps/test/date.html"), true);
> dateWriter.println(now);
> dateWriter.println("<br>");
> dateWriter.println("<a
> href=\"servlet/DateServlet\">Update</a>");
> dateWriter.close();
>
> response.setContentType("text/html");
> PrintWriter out = response.getWriter();
> out.println(now);
> out.println("<meta http-equiv='refresh'
> content='3; url=\"/test/date.html\"'></meta>");
>
> } catch(Exception ex) {
> PrintWriter errorWriter = new
> PrintWriter(new FileWriter("../webapps/bib/error.txt"), true);
> ex.printStackTrace(errorWriter);
> errorWriter.close();
> }
> }
>
> }
>
> Did anyone else experiment such problems?
>
> Cheers,
> Michele
>
--
To unsubscribe: <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>