1 16 package org.apache.cocoon.ajax; 17 18 import java.util.Collections ; 19 import java.util.Map ; 20 21 import org.apache.avalon.framework.activity.Disposable; 22 import org.apache.avalon.framework.parameters.Parameters; 23 import org.apache.avalon.framework.service.ServiceException; 24 import org.apache.avalon.framework.service.ServiceManager; 25 import org.apache.avalon.framework.thread.ThreadSafe; 26 import org.apache.cocoon.acting.ServiceableAction; 27 import org.apache.cocoon.components.flow.ContinuationsManager; 28 import org.apache.cocoon.components.flow.FlowHelper; 29 import org.apache.cocoon.components.flow.WebContinuation; 30 import org.apache.cocoon.environment.ObjectModelHelper; 31 import org.apache.cocoon.environment.Redirector; 32 import org.apache.cocoon.environment.SourceResolver; 33 import org.apache.cocoon.sitemap.SitemapParameters; 34 35 49 public class GetContinuationAction extends ServiceableAction implements ThreadSafe, Disposable { 50 ContinuationsManager contManager; 51 52 public void service(ServiceManager manager) throws ServiceException { 53 super.service(manager); 54 this.contManager = (ContinuationsManager)manager.lookup(ContinuationsManager.ROLE); 55 } 56 57 public Map act(Redirector redirector, SourceResolver resolver, Map objectModel, String source, Parameters parameters) throws Exception { 58 String continuationId; 59 if (source == null) { 60 continuationId = ObjectModelHelper.getRequest(objectModel).getParameter("continuation-id"); 61 } else { 62 continuationId = source; 63 } 64 65 String interpreterId = SitemapParameters.getLocation(parameters).getURI(); 67 WebContinuation wk = this.contManager.lookupWebContinuation(continuationId, interpreterId); 68 if (wk == null || wk.disposed()) { 69 return null; 70 } else { 71 wk.getContinuation(); 73 FlowHelper.setWebContinuation(objectModel, wk); 74 return Collections.EMPTY_MAP; 75 } 76 } 77 78 public void dispose() { 79 this.manager.release(this.contManager); 80 } 81 } 82 | Popular Tags |