cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simon.mi...@t-online.de (Simon Mieth)
Subject CocoonBean followLink problem
Date Fri, 19 Sep 2003 12:03:44 GMT
Hi all,

i trying to integrate Cocoon via CocoonBean into my application. This work really fine, but
 the "followLinks" don't  process every last link in every page.
After trying with CLI, i got the same problem. I looked into the Source CocoonBean.java and
found in the method process() the possible problem/bug.

Every page is search for links and all were found, but every last found target will removed.

-- codepart from CocoonBean.process() --

       while (targetMap.size() > 0) {
            Target target = (Target) targetMap.keySet().iterator().next();
            try {
                if (!allProcessedLinks.containsKey(target)) {
                    if (precompileOnly) {
                        processXSP(target.getSourceURI());
                    } else if (this.followLinks) {



// Here are all links searched and the put into the targetMap



                        i = processTarget(target).iterator();
                        while (i.hasNext()) {
                            target = (Target) i.next(); 
                            targetMap.put(target, target); 
                        }




                    } else {
                        processTarget(target);
                    }
                }
            } catch (ResourceNotFoundException rnfe) {
                this.sendBrokenLinkWarning(target.getSourceURI(), rnfe.getMessage());
            }


 //but here the last target will removed here


            targetMap.remove(target);
            nCount++;


-- end codepart --

After changing this to the following

-- my codepart to CocoonBean.process() --

       while (targetMap.size() > 0) {
            Target target = (Target) targetMap.keySet().iterator().next();
            try {
                if (!allProcessedLinks.containsKey(target)) {
                    if (precompileOnly) {
                        processXSP(target.getSourceURI());
                    } else if (this.followLinks) {
                        i = processTarget(target).iterator();
                        while (i.hasNext()) {



// my changes here


                            Target child = (Target) i.next(); 
                            targetMap.put(child, child); 


                        }

                    } else {
                        processTarget(target);
                    }
                }
            } catch (ResourceNotFoundException rnfe) {
                this.sendBrokenLinkWarning(target.getSourceURI(), rnfe.getMessage());
            }

            targetMap.remove(target);
            nCount++;


-- end codepart --

it will as expected.

I don't know if these broke other thing, so i applied the patch with this email.


I hope it helps and thanks for Cocoon,

Simon



Mime
View raw message