cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Philippe Guillard <pguill...@citycita.net>
Subject "Reset" cachingURI coplet
Date Thu, 26 May 2005 06:26:16 GMT
Hi all,

I try there since i get no answer on the user-list. My question is also
the same as this old mail
http://www.mail-archive.com/users@cocoon.apache.org/msg12028.html.

I'm looking for some idea/solution to refresh a cachingURI coplet
content after a form in portal has been submitted. Then a user going to
other tabs and going back would not see the "success" page again.
This may explain better my need:

function show(form) {
  populate(form);
  form.showForm("display-pipeline");
  saveToDB(form);
  cocoon.sendPage("success-pipeline");
  resetCoplet("instance_name");
}

function resetCoplet() {
  // this is pseudo code remember!
  thisCoplet.resetTemporaryURI();
  thisCoplet.invalidateCache();
  // Now next time this coplet will be generated from scratch
}


This is what i have written at the moment. I see no exceptions, but with
no effect at all:

function resetCoplet(instanceName) {
    var service = null;
    try {
           // get portal service
           service =
cocoon.getComponent(org.apache.cocoon.portal.PortalService.ROLE);
           service.setPortalName("portal");
           // get profile manager
           var componentManager = service.getComponentManager();
           var profileManager = componentManager.getProfileManager();
            var cid = profileManager.getCopletInstanceData(instanceName);
        var event = null;
        var path = "temporaryAttributes/application-uri";
        var value = "cocoon://portal/coplets/profiler/profile";
        if ( cid != null ) {
            // create event
            event = new
Packages.org.apache.cocoon.portal.event.impl.CopletJXPathEvent(cid,
path, value);
            // subscribe it

service.getComponentManager().getEventManager().getPublisher().publish(event);
            // invalidate cache
               var cachingURICopletAdapter = new
Packages.org.apache.cocoon.portal.coplet.adapter.impl.CachingURICopletAdapter();
            cachingURICopletAdapter.setCacheInvalid(cid);
        }
    } catch ( e ) {
       cocoon.log.info("Error", e);
    }
    finally {
       cocoon.releaseComponent( service );
    }
}

Somebody can help?

PHIL



Mime
View raw message