[flexcoders] Re: Reusing HTTPService

2008-10-17 Thread lagos_tout
Yeah, that's a great idea. Kind of like the Command pattern with handlers, right? LT --- In flexcoders@yahoogroups.com, Dmitri Girski [EMAIL PROTECTED] wrote: No worries. BTW, there is another way of doing it - each request is represented by some object which creates HTTPService and

Re: [flexcoders] Re: Reusing HTTPService

2008-10-17 Thread shaun
How about something like this: (note: I've not tried it, just slapped it straight into the email) public class MyClassThatInvokesHTTPServices { //inner helper class. class MyIResponder implements IResponder{ public var f:Function; public var r:Function; public

[flexcoders] Re: Reusing HTTPService

2008-10-17 Thread lagos_tout
I like! This line says it all: service.send().addResponder(new MyIResponder(resultB, faultB)); Thanks much. I think this is the solution. It meets my requirements: no long conditionals; one-to-one matching of service calls to fault/result handlers; reuse of the same service object;

RE: [flexcoders] Re: Reusing HTTPService

2008-10-17 Thread Jeff Vroom
: [flexcoders] Re: Reusing HTTPService I like! This line says it all: service.send().addResponder(new MyIResponder(resultB, faultB)); Thanks much. I think this is the solution. It meets my requirements: no long conditionals; one-to-one matching of service calls to fault/result handlers; reuse of the same

[flexcoders] Re: Reusing HTTPService

2008-10-16 Thread lagos_tout
Hi, Tracy. Thanks for your response. It's good to hear that others use this solution. Makes me feel like it's not just a stop-gap hack. However, what made me uncomfortable is the idea in OOP that classes should be open to extension, closed to modification. It's generally a code smell if one

[flexcoders] Re: Reusing HTTPService

2008-10-16 Thread lagos_tout
Thanks, Dmitri. This is a great idea. Unfortunately though, in this project, I don't have control over what's returned by the server, so I can't add the requestId. But with your suggestion, you still end up needing to match requestIds with handlers on the client right? So do you use a

[flexcoders] Re: Reusing HTTPService

2008-10-16 Thread Dmitri Girski
No worries. BTW, there is another way of doing it - each request is represented by some object which creates HTTPService and subscribes for the response. Because each instance sends single request, there is no problem to decode the response. Cheers, Dmitri. --- In

RE: [flexcoders] Re: Reusing HTTPService

2008-10-16 Thread Tracy Spratt
@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of lagos_tout Sent: Thursday, October 16, 2008 2:26 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Reusing HTTPService Hi, Tracy. Thanks for your response. It's good to hear that others use this solution. Makes me feel like it's

[flexcoders] Re: Reusing HTTPService

2008-10-15 Thread Dmitri Girski
If I were you, I would simply add the requestId into the server's response, so client always knows which request-response pair it handles. This idea lies behind most of the transmissions protocols. Cheers, Dmitri. --- In flexcoders@yahoogroups.com, lagos_tout [EMAIL PROTECTED] wrote: Hi,