Thanks a lot!
I finally get i didn't invalidate the coplet cache correctly and used
your way.
Below is what i have all-in-one, if others are interested...
Regards,
Phil
____________________________________
function resetCoplet(copletId, tempURI) {
var service = null;
try {
// get portal service/profile manager/coplet
service =
cocoon.getComponent(org.apache.cocoon.portal.PortalService.ROLE);
service.setPortalName("portal");
var componentManager = service.getComponentManager();
var profileManager = componentManager.getProfileManager();
var coplet = profileManager.getCopletInstanceData(copletId);
var path = "temporaryAttributes/application-uri";
var value = tempURI;
var cachingURICopletAdapter = new
Packages.org.apache.cocoon.portal.coplet.adapter.impl.CachingURICopletAdapter();
if ( coplet != null ) {
// invalidate cache
coplet.setAttribute(org.apache.cocoon.portal.coplet.adapter.impl.CachingURICopletAdapter.DO_NOT_CACHE,
"true");
cocoon.log.debug("cache invalidated for coplet="+copletId);
// create event and suscribe it
var event = new
Packages.org.apache.cocoon.portal.event.impl.CopletJXPathEvent(coplet,
path, value);
service.getComponentManager().getEventManager().getPublisher().publish(event);
cocoon.log.debug("tempURI changed for coplet="+copletId);
} else {
cocoon.log.error("This coplet doesn't exist="+copletId);
}
} catch ( e ) {
cocoon.log.info("Error", e);
}
finally {
cocoon.releaseComponent( service );
}
}
Jean-Baptiste Quenot wrote:
* Philippe Guillard:
Looks really good. Unfortunately it does the same for me, no
errors and the succes page is still displayed! It seems i do
not cache the response, the coplet temporaryURI is still
with the continuation, so the response is regenerated because
flowscript starts again at the continuation point.
The form action points to a pipeline called
"invalidateCacheForCoplet", and in turn calling a flowscript
to invalidate the coplet upon form submission. And finally
the request is forwarded to "portal". We don't use this
temporary:application-uri hack.
Here is what it looks like:
function invalidateCacheForCoplet(copletId)
{
// Get the coplet
var service = cocoon.getComponent(org.apache.cocoon.portal.PortalService.ROLE);
var profileManager = service.getComponentManager().getProfileManager();
var coplet = profileManager.getCopletInstanceData(copletId);
// Set the cache of the coplet as invalid
// Note : this code comes from CachingURICopletAdapter
coplet.setAttribute(org.apache.cocoon.portal.coplet.adapter.impl.CachingURICopletAdapter.CACHE_VALIDITY,
org.apache.cocoon.portal.coplet.adapter.impl.CachingURICopletAdapter.CACHE_INVALID);
cocoon.sendPage("portal");
}
Cheers,