Title: RE: How do i cache a JSP on the proxy?

I think your getLastModified() logic is not proper.  You are sending lastmodified time as current time*15 which means the lastmodification time is newer the proxy thinks that this page got changed.  Try this logic

public long getLastModified()
{
        File file = new File(getServletContext().getRealPath("jspfilename.jsp"));
        return file.lastModified();
}



Kesav Kumar
Software Engineer
Voquette, Inc.
650 356 3740
mailto:[EMAIL PROTECTED]
http://www.voquette.com
Voquette...Delivering Sound Information


-----Original Message-----
From: Eduard Witteveen [mailto:[EMAIL PROTECTED]]
Sent: Friday, June 08, 2001 7:23 AM
To: Orion-Interest
Subject: How do i cache a JSP on the proxy?


Hello,

I want to cache a jsp page on the proxy (apache).

My current setup is that i have apache running on port 80, with following config:
        <VirtualHost 145.58.67.8>
            ServerName eduard.omroep.nl
            ServerAlias eduard
            ErrorLog /var/proxy/logs/errors
            CustomLog /var/proxy/logs/access common

            ProxyPass / http://localhost:8080/
            CacheRoot "/tmp/proxy"
        </VirtualHost>

Furthermore the orionserver is running on port 8080, and has the following 'special' settings:
        <frontend host="eduard.omroep.nl" port="80" />

For the testing purposes i have the following jsp page:
        <%@ page session="false" %>
        <%! int counter = 0; %>
        <%!
                // return a time back, which is +15 seconds..
                public long getLastModified(HttpServletRequest request) {
                        System.out.println("in last modified");
                        // return 15 seconds..
                        return System.currentTimeMillis() * (15 * 1000) ;
                }
        %>

        <%
                long seconds = 15;
                long now = System.currentTimeMillis();
                long expires = now + (seconds * 1000);

                response.setDateHeader("Expires", expires);
                System.out.println("in source.." + now + "->" +  expires);
        %>
        <html>
        <body>
        <p>This page was generated on time:<%= now %><br />
        Will expire at:<%= expires %><br />
        Expire time in seconds:<%= seconds %><br />
        Count:<%= counter++ %></p>
        </body>
        </html>

Everytime i request the page, the counter is increased, but this is not what i want. I want to increased at an maximum of 1 time in the 15 seconds.

Can somebody help me how to accomplish this, or possible otherways to cache the jsp pages on the front proxy?

greatings,

--
Eduard Witteveen Systeem Ontwikkelaar
NOS Internet,  Mediacentrum Kamer 203
+31(0)356773059 http://www.omroep.nl/

Sed quis custodiet ipsos custodes? : The sixth Satire from Juvenal

Reply via email to