Consider this:

URL baseUrl = new URL("file:///C:/temp/");
Pipeline pipeline = new NonCachingPipeline();
pipeline.addComponent(new FileGenerator(new URL(baseUrl, "xyz.xml"));
pipeline.addComponent(new XSLTTransformer(new URL(baseUrl, "xyz.xslt"));
pipeline.addComponent(new XMLSerializer());
pipeline.invoke(new InvocationImpl(System.out));

This simple pipeline has these potentially cacheable components; xyz.xml, xyz.xslt, the result of the XSLT transformation, and the final result of the pipeline. As it relates to the pipeline I don't see how the URL.getLastModified() really helps as it could apply to any of these items, two of which aren't even URLs.

Ralph

Steven Dolg wrote:


Carsten Ziegeler schrieb:
Steven Dolg wrote:
How about:

URL url = new URL("some url");
UrlConnection connection = url.openConnection();
connection.getLastModified();

Not sure it this really works in all cases, but appears to be quite suitable and easily extensible.

Yes, this works for many cases, but not for cases like where you have an expiry date etc. What do you mean by "easily extensible"?
url.openConnection() actually returns a subclass of URLConnection depending on the protocol of the URL. So own protocol implementations can return own subclasses that implement this (and other methods) accordingly. And - at least theoretically - provide additional methods for handling specific stuff, e.g. expiration dates.

Carsten

Reply via email to