On 30.03.2004 01:54, Gustavo Nalle Fernandes wrote:

Interesting class Joerg. A couple of observations:

 1) The remote site DO have Last-modified header and Cocoon is issuing a GET
request instead of a HEAD request
 to obtain the header value. This is a common mistake made when using the
java.net.HttpURLConnection class. If you
 want to make a HEAD request, you must use setRequestMethod("HEAD") on your
HttpURLConnection class before calling
 the method to obtain the header value.

Unfortunately this is out of my knowledge. You mean getLastModified() would not work on a GET request? But aren't the header sent to on a GET request?


 2) Regarding your implementation, I found very promising the idea of
creating a subclassed HTMLGenerator that
 enables us to control the cache timeout. I am kind of a newbie in cocoon
source code, so could you
 provide me general guidelines on how could I create a external sitemap
parameter to manage this time interval? It would
 replace the hard coded value "10000" in your code.

Also easy :) The HTMLGenerator has some examples for this, e.g. xpath parameter: xpath = par.getParameter("xpath", null);
The first one is the parameter name, the second one the default value.



The class could then look like:


public class DelayedHTMLGenerator extends HTMLGenerator {

protected int delay;

   public void setup(SourceResolver resolver, Map objectModel,
                     String src, Parameters par)
   throws ProcessingException, SAXException, IOException {
     super.setup(resolver, objectModel, src, par);

delay = par.getParameterAsInteger("delay", 1000);

     this.inputSource =
            new DelayedRefreshSourceWrapper(this.inputSource, delay);
   }
}

You would specify it in the sitemap like the following:

<map:generate type="delayhtml" src="url">
  <map:parameter name="delay" value="10000"/>
</map:generate>

Joerg

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to