cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Carsten Ziegeler" <cziege...@sundn.de>
Subject AW: [c2] timeout parameter to FileGenerator
Date Wed, 16 May 2001 10:30:40 GMT
> Donald Ball wrote:
>
> so i was taking a look at implementing this and noticed something. it
> would appear that the first access of an external resources will result in
> two HTTP requests. the setup method is:
>
>     public void setup(EntityResolver resolver, Map objectModel, String
> src, Parameters par)
>         throws ProcessingException, SAXException, IOException {
>         super.setup(resolver, objectModel, src, par);
>         this.inputSource = super.resolver.resolveEntity(null,
> super.source);
>         this.systemID = this.inputSource.getSystemId();
>         if (this.systemID.startsWith(FILE) == true) {
>             File xmlFile = new
> File(this.systemID.substring(FILE.length()));
>             this.lastModificationDate = xmlFile.lastModified();
>         } else {
>             try {
>                 java.net.URL u= new java.net.URL(this.systemID);
>                 java.net.URLConnection conn = u.openConnection();
>                 this.lastModificationDate =
> u.openConnection().getLastModified();
>             } catch (java.net.MalformedURLException local) {
>                 // we ignore this at this stage
>                 this.lastModificationDate = 0; // no caching!
>             }
>         }
>     }
>
> which involves one url connection being fired off, and then in the
> generate method, the parser will fire off another connection:
>
>             parser.parse(this.inputSource);
>
> hmm. that's not so good. is this an accurate assessment?
>
Yes, absolutely, it's totally bad. It was a first quick shot at
implementing caching for the file generator. This really should
be changed.
As far as I know this code is used in several components.


Carsten

Open Source Group                        sunShine - b:Integrated
================================================================
Carsten Ziegeler, S&N AG, Klingenderstrasse 5, D-33100 Paderborn
www.sundn.de                          mailto: cziegeler@sundn.de
================================================================


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Mime
View raw message