public void handleContinuation(String id, List params, Redirector redirector)
throws Exception {
if (!initialized)
initialize();
WebContinuation parentwk = continuationsMgr.lookupWebContinuation(id, getInterpreterID());
if (parentwk == null) {
/*
* Throw an InvalidContinuationException to be handled inside the
* <map:handle-errors> sitemap element.
*/
throw new InvalidContinuationException("The continuation ID " + id + " is invalid.");
}
Continuation parentContinuation = (Continuation) parentwk.getContinuation();
Method method = (Method) methods.get(parentContinuation.getFunctionName());
Request request = ContextHelper.getRequest(this.avalonContext);
Session session = request.getSession(true);
HashMap userScopes = (HashMap) session.getAttribute(USER_GLOBAL_SCOPE);
Continuable flow = (Continuable) userScopes.get(method.getDeclaringClass());
ContinuationContext context = new ContinuationContext();
context.setObject(flow);
context.setMethod(method);
context.setAvalonContext(avalonContext);
context.setLogger(getLogger());
context.setServiceManager(manager);
context.setRedirector(redirector);
Parameters parameters = new Parameters();
for(Iterator i=params.iterator(); i.hasNext();) {
Argument argument = (Argument)i.next();
parameters.setParameter(argument.name, argument.value);
}
context.setParameters(parameters);
Continuation continuation = new Continuation(parentContinuation, context);
WebContinuation wk = continuationsMgr.createWebContinuation(
continuation, parentwk, timeToLive, getInterpreterID(), null);
FlowHelper.setWebContinuation(ContextHelper.getObjectModel(this.avalonContext), wk);
continuation.registerThread();
try {