View Javadoc

1   /*
2    * $Id: JettyContinuationsReplyToHandler.java 20321 2010-11-24 15:21:24Z dfeist $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  package org.mule.transport.servlet.jetty;
11  
12  import org.mule.api.MuleContext;
13  import org.mule.api.MuleEvent;
14  import org.mule.api.MuleException;
15  import org.mule.api.MuleMessage;
16  import org.mule.api.transformer.Transformer;
17  import org.mule.transport.DefaultReplyToHandler;
18  
19  import java.util.List;
20  
21  import org.mortbay.util.ajax.Continuation;
22  
23  /**
24   * This handler is responsible for resuming the continuation for the current request
25   */
26  public class JettyContinuationsReplyToHandler extends DefaultReplyToHandler
27  {
28      public JettyContinuationsReplyToHandler(List<Transformer> transformers, MuleContext muleContext)
29      {
30          super(transformers, muleContext);
31      }
32  
33      @Override
34      public void processReplyTo(MuleEvent event, MuleMessage returnMessage, Object replyTo) throws MuleException
35      {
36          Continuation continuation = (Continuation)replyTo;
37          continuation.setObject(returnMessage);
38          continuation.resume();
39      }
40  }