PDA

View Full Version : Understanding HTTPProxy Posts and Server response



jbeaven
26 Oct 2011, 9:58 AM
So I'm not new to ExtJS per se but I am new to trying to debug server interactions with Ext.

I have my store built with a proxy like so:


this.stateStore = new Ext.data.JsonStore({
autoDestroy: true,
autoLoad: false,
autoSave: false,
proxy: new Ext.data.HttpProxy({
api: {
create : contextRoot + '/home/updatePreference',
read : contextRoot + '/home/getPreferences',
update: contextRoot + '/home/updatePreference',
destroy : contextRoot + '/home/deletePreference'
}
}),
storeId: 'jsonStateStore',
....


and right now I'm debuggin my create/update. I can read fine but when I save my store it calls the updatePreference in my controller (I'm using Spring too) which looks like this:


@RequestMapping(value="userpreference/updatePreference", method=RequestMethod.POST)
public @ResponseBody ExtData updatePreference(Model model, HttpServletRequest request, @RequestBody String body)
{
log.info(body.toString());
ExtData blankExtData = new ExtData();
blankExtData.setSuccess(true);

return blankExtData;

}


ExtData is just a class that uses Jackson JSON to format the responses into JSON for ext to use.

But each time the save is called (which occurs beforeunload) I'm getting this response object:




argument

undefined







isAbort









false











isTimeout







undefined











status




0








statusText




"communication failure"








tId




5







Any thoughts as to why I'm getting this seeming communication failure? My controller method is being called fine but the exception listener I have on the store is always getting called.