PDA

View Full Version : How to prevent cookies created by CookieProvider to be sent to server



grzegorz.borkowski
11 Jun 2009, 3:04 PM
I'm starting to play with state management and CookieProvider. Everything works pretty good, but one issue is not clear for me. The cookies created by CookieProvider are purely client-side artifacts. There is no point in sending them to server when requests to server are sent. This is not a big problem when you use state storage only in limited number of places of your application, but when you start to add more and more data into it, the size of cookie increases, and sending it to server is a waste of bandwidth.
Say my application is located at http://myserver.org/myapp/, and I defined CookieProvider to use "/myapp" path for cookie:

Ext.state.Manager.setProvider(new Ext.state.CookieProvider({
path: window.location.pathname
}));
then the cookie will be sent with every request for every static file under this path: scripts, csses, graphics.
So my first idea was to add some dummy path to the cookie:

Ext.state.Manager.setProvider(new Ext.state.CookieProvider({
path: window.location.pathname + "CLIENT-SIDE-STATE/"
}));
However, this doesn't work. The cookie is created, by the state is never restored from it.
Is there some solution already identified for this?