View Full Version : Direct Remoting Exception Handling Help

3 Aug 2009, 3:39 PM

I have started using the Ext.Direct with Java on the server stack. I am trying to handle the case where the user session is invalid, and based on this I would like to redirect the user to the login page.

I noticed in the documentation for Ext.Direct and Ext.RemotingProvider that both have an exception event but does not fire for invalid response objects.

Also in the Ext.direct there are the following as stated in docs:

* Ext.Direct.exceptions.TRANSPORT : 'xhr'
* Ext.Direct.exceptions.PARSE : 'parse'
* Ext.Direct.exceptions.LOGIN : 'login'
* Ext.Direct.exceptions.SERVER : 'exception'

how can I make use of these? Any help would be great!

4 Aug 2009, 12:06 AM
So that we can help you better, provide us with

- Your client Javascript code: both a) the code calling the server method and b) the exception handling code.
- Your server side Java code.
- The request data ExtJs sent to the server.
- The response data the server returned.

If are you using DirectJNgine, you can get the request and response data by modifying the log4j trace level as explained in its User's Guide and taking a look at the logs.


As an aside, depending on the type of error, you might need to handle it in your callback function, not in an 'exception' event handler.

For example:

FormSupportTest.handleFormCausingServerException(form.getForm().el, function(result, e) {
if (e.type === "exception") {
Ext.MessageBox.alert("Form post finished with server error", "Error: " + e.message);
else {
Ext.MessageBox.alert("BUG! Test failed: ", "We expected this to be successful");


This is just an example, though: error handling depends on the context. We need to take a look at your code.



20 Aug 2009, 3:51 PM
Sorry if I sound late on this but first of all, I am just beginning to get my feet wet with DWR and now weve got Ext.Driect, assuming all I care about is Java on the server side, with DWR do I still need Ext.Direct ??

Ext.Direct is great news all the same

20 Aug 2009, 11:23 PM
You can use DWR without having to use Ext.Direct.

You might want to take a look at http://extjs.com/forum/showthread.php?t=73331 for some comments on DirectJNgine (a Java based implementation of Ext.Direct) vs. DWR.