Using response.sendRedirect() within GWT Framework

217 views
Skip to first unread message

Vicky

unread,
Nov 13, 2007, 2:22:53 AM11/13/07
to Google Web Toolkit
Hi,

We have an existing application which is developed in GWT (1.2)
framework.I want to have an authentication check at a central location
within the application and redirect the user to the login page if he/
she is not authenticated.

The solution that i tried for this is to have a ServletFilter, which
would check the user principal and do a response.sendRedirect() if the
user is not authenticated. But unfortunetly this does not work. I
think this is due to the Ajax based nature of the GWT framework. But i
would appreciate if some one would throw some more light on why
response.sendRedirect does not work in GWT framework.

Another thing i was looking for is if we cannot use
response.sendredirect() with GWT, what could be another approach that
can be used for the above usecase.

Thanks and Regards,
Vicky

mP

unread,
Nov 13, 2007, 3:58:20 AM11/13/07
to Google Web Toolkit
sendRedirect doesnt work because GWT is using the server as a server
rather than a source of pages.

The response of an ajax call is just text. Its up your code to do
something with it.

It just doesnt ever make sense to send redirect to a gwt rpc request.

Throw an exception on the client to say the client has failed to
authenticate and handle the exception, show them an alert and prompt
them with a modal dialog box for their name/passs.

Reply all
Reply to author
Forward
0 new messages