how did you define your RemoteService methods? have you defined them
to throw exceptions?
GWT RPC works the way that it tries to forward (serialize) caught
exception to the client, if it is able to. that means, that if you
throw a NPE from your service implementation, you dont get 500 code
from the server, rather it would be http 200 (ok) and the exception is
serialized and streamed to the client, where RPC stack detects that
this is an exception and propagates to the onFailure() callback of the
Async implementation.
So the servlet container never guess there went something wrong.
On the other hand - I would not advise to break it, you dont need your
custom error handling for RPC, since you never call them manually
(i.e. by link) but rather over RPC, so a common error.jsp showing up
some warning information to the user would never do its job here,
since a user would never see that page.
On 25 Nov., 06:30, Yaakov <yaakov.chai...@gmail.com> wrote:
> Hi,
>
> I thought I have done this before with GWT...
>
> I have an RPC call to some resource. If something unforeseen (untested
> bug) happens during the RPC call in the server-side processing, I want
> to use the regular error-page mechanism to automatically redirect the
> browser to some standard error page (where it would announce that we
> are finding whoever introduced that bug and firing them :-) )
>
> I set this up in web.xml like this:
> <error-page>
> <exception-type>java.lang.Exception</exception-type>
> <location>/WEB-INF/pages/error.jsp</location>
> </error-page>
>
> For testing, I try throwing NullPointerException from within my server-
> side code. The exception seems to slip through the 'error-page'
> mechanism and still shows up in GWT, i.e., in the browser with this:
> "com.google.gwt.user.client.rpc.StatusCodeException: The call failed
> on the server; see server log for details"
>
> Is what I am trying to do not possible in GWT??? Frankly, and maybe
> because it's late :-), I don't understand why the 'error-page'
> mechanism doesn't kick in no matter what and return the contents of
> the error.jsp page at least. I.e., GWT should have no idea that an
> error even occurred because the 'error-page' mechanism should have
> caught it before the response goes back to the client.
>
> Any ideas anyone?
>
> Thanks,
> Yaakov.
--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
No comments:
Post a Comment