Caching servlet??

From: William Deng <xde3799@dont-contact.us>
Date: Tue, 22 Feb 2000 17:14:49 -0600

Hi, All

I try to cache the result returned by a servlet. But squid did not cache for me. My front end looks like

String URLstring=......;
    String xmlReqString=".....";
    try {
      URL servletURL = new URL(URLstring);
      URLConnection servletConn = servletURL.openConnection();
        // need to both read AND write to servlet so set to true
      servletConn.setDoOutput(true);
      // get output stream to connection
      PrintWriter servletOut = new PrintWriter(servletConn.getOutputStream());
      // encode the xml request string in x-www-form-urlencoded format to be transmitte
      String xmlReqEncoded = URLEncoder.encode(xmlReqString);

      servletOut.println(xmlReqString);

     }....

 At my servlet side, I added response.setHeader ("Expires",
                       "Mon, 01 Jan 2001 00:00:00 GMT").

The squid cached when I tried lynx://localhost/servlet/Hello which I think it uses "GET" method.

I print out the request at servlet side. I find out that URLConnection used a "POST" mothed. Is there any way that I can

cache the result returned from servlet?

Thanks

William
Received on Tue Feb 22 2000 - 23:52:58 MST

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:51:26 MST