View Full Version : Proxies?

11 Aug 2009, 10:11 PM

I just started working with ExtJS and its absolutly great and meets everything I need.

First of all I have a simple question to you: For what do I need Proxies at all? I know that
a proxy is needed e.g. if you want to load data from a different domain, but HttpProxy doesnīt
have this features. And so I guess that there are some other things that make proxies worthy.
Can someone illuminate me?

Thanks ;)

11 Aug 2009, 10:18 PM
You want the ScriptTagProxy which does allow cross domain data loading.

11 Aug 2009, 11:03 PM
That was not my question. I want to know what OTHER advantages/features proxies have ....

11 Aug 2009, 11:19 PM
Then I just don't understand your question - have you read the docs on DataProxy, HttpProxy etc? The proxy is used in conjuction with a data reader and store to load data. What further advantages do you require?

12 Aug 2009, 12:02 AM
I donīt mean any special proxy, I just donīt know what differs between loading data into a store with a proxy or just plain with a reader (without a proxy)?

To be more specific: What for do I need a HttpProxy? The docs say: An implementation of Ext.data.DataProxy that processes data requests within the same domain of the originating page.

Okay, but I can do this also without using a proxy, donīt I? At the moment my servlet returns a JSON-string which I convert into a JSON-object, which can be loaded mystore.loadData(mydata). No proxy in between ... and now back to my first posting and original question: What advantage can I expect using a HttpProxy?

12 Aug 2009, 2:44 AM
DataProxy abstracts the server data retrieval.

By choosing a different proxy you can use a different retrieval method:
HttpProxy -> Uses Ext.data.Connection (which uses XmlHttpRequest).
ScriptTagProxy -> Uses a <script> tag to allow cross-domain requests.
MemoryProxy -> Uses a predefined data object (useful for debugging).
DirectProxy -> Uses Ext.direct.

12 Aug 2009, 3:28 AM
Ok, these are the differences between the single proxies.

But what would be the the difference between using a proxy in a store and using no proxy?

Thanks ... :> B)

12 Aug 2009, 3:37 AM
A store doesn't need a proxy if you define 'data' in the config.

But if you don't specify 'data' or 'proxy', a HttpProxy is created automatically (using the 'url' from the store config).

12 Aug 2009, 3:44 AM
Ahh, ok ... thatīs the information I was looking for!

Formerly I was using a Ajax-call and created a well formatted JSON-object from the response
which I was loading into the store by using the loadData()-method.

Using the built-in methods ("proxy" or "url"), which both use HttpProxy as you say,
looks a bit more comfortable. ;)

Thanks very much! B)