Nitin Khattar wrote:
>
> This is the method which i have added to the Servlet
>
> public long getLastModified(HttpServletRequest req) {
> return new Date().getTime() /1000 * 1000;
> }
>
> it doesnt work still....
>
> Ok i finally got it('If-Modified-Since' Header). I set the
> response header "Last-Modified" as under
>
> res.setDateHeader("Last-Modified",System.currentTimeMillis();
>
getLastModified() should do exactly that. If you choose to
do it all by hand, then you have to deal with a couple of
other protocol issues as well. It's suprisingly complex. There
are some good discussions in the archive about doing it manually
(which you can find as soon as the search function starts working
again).
You might want to keep in mind that if you always set the
last modified date to the current time, the client will always
think its copy is out of date and the server will always
send a full copy of the page. If you want to hand-code a test,
figure out the current-time-in-millis for earlier today, and
hardcode that into getLastModified(), something like:
-----------------------8<----------8<--------------------------
public class test_ims_servlet extends HttpServlet {
public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
PrintWriter optr = resp.getWriter();
resp.setContentType("text/html");
optr.println("<HTML>");
optr.println("<BODY>");
optr.println("<P>test_ims_servlet::test_ims_servlet()</P>");
optr.println("</BODY>");
optr.println("</HTML>");
}
public long getLastModified(HttpServletRequest req) {
return 969285920000L;
}
}
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html