source: EDIS/trunk/java/tracking-ui-core/src/main/flex/gov/va/med/edp/business/ResponderChainingDelegate.as@ 1227

Last change on this file since 1227 was 1227, checked in by George Lilly, 13 years ago

initial load of EDIS 1.0

File size: 1.2 KB
Line 
1package gov.va.med.edp.business
2{
3 import com.adobe.cairngorm.business.ServiceLocator;
4
5 import gov.va.med.edp.business.responder.XMLResultFormattingResponder;
6 import gov.va.med.edp.business.responder.ServerErrorCheckResponder;
7
8 import mx.rpc.AsyncToken;
9 import mx.rpc.IResponder;
10
11 /**
12 * Base class for Cairngorm service delegates that sends IResponder methods
13 * to a chain of decorator responders which eventually forward result and fault methods
14 * to responder specified on construction.
15 */
16 public class ResponderChainingDelegate
17 {
18 private var responder:IResponder;
19 private var service:Object;
20
21 public function ResponderChainingDelegate(responder:IResponder, serviceName:String) {
22 this.service = ServiceLocator.getInstance().getHTTPService(serviceName);
23 this.responder = createResponderChain(responder);
24 }
25
26 protected function createResponderChain(lastResponder: IResponder) : IResponder {
27 return new XMLResultFormattingResponder(new ServerErrorCheckResponder(lastResponder));
28 }
29
30 public final function send(params:Object = null) : void {
31 var token:AsyncToken = service.send(params);
32 token.addResponder(responder);
33 }
34 }
35}
Note: See TracBrowser for help on using the repository browser.