View Full Version : HttpProxy Connection Scope

4 Nov 2010, 2:32 PM
I seem to have come across a rather interesting issue with HttpProxy with regard to the contained Connection object. Basically, I have an init method that creates a new HttpProxy and then registers a 'requestcomplete' with the connection object contained within the proxy. The strange thing is that my event handler is being invoked for future requests that have absolutely nothing to do with the proxy.

For example, in my event handler I'm parsing the response as JSON and then checking the raw response for a specific status code. This works fine for the the JsonStore that I've registered the proxy with, but in an entirely separate method I'm trying to create an Ext Window using the autoLoad config param and for some reason it's invoking the event handler on the connection object of the previously created HttpProxy. It looks like the connection object has a sort of shared 'singleton' scope rather than a connection per instance. I've tried httpProxy.conn = new Ext.data.Connection() before registering my event handler, but to no avail.

Any Ideas?

4 Nov 2010, 2:43 PM
Not without code, no.

4 Nov 2010, 2:46 PM
Found the solution in another thread: you need to construct the HttpProxy with a new Ext.data.Connection({url:url})

Odd that httpProxy.conn = new Ext.data.Connection() didn't seem to resolve the problem though.

4 Nov 2010, 2:54 PM
Not without code, no.

Sorry man, I figured it was pretty evident that I was trying to use the normal HttpProxy constructor with a url since I tried to set the conn property of the proxy to a new Ext.data.Connection(). Wouldn't make much sense to provide a Connection instance in the constructor and then turn around and try to override it with a new assignment.