Calling the GWT entry module from a servlet

30 views
Skip to first unread message

jayanth

unread,
Mar 8, 2010, 4:47:28 PM3/8/10
to Google Web Toolkit
I have an AuthenticatorServlet that among other things displays a page
to capture username and password and upon form submission validates
credentials against an LDAP server. From this servlet, I would like to
invoke the GWT initial html page and am looking for best practices to
do this.

I am currently performing a response.sendRedirect (..) which appears
to do the job but fear this may not be the best way to achieve what I
am looking for.

Any help is appreciated. Thanks.

rjcarr

unread,
Mar 9, 2010, 3:28:56 AM3/9/10
to Google Web Toolkit
For your situation, I think using the redirect makes the most sense.
This tells the browser to request another resource (i.e., the gwt
html).

The other option is to use a request dispatcher. This is basically a
servlet calling another servlet, but it sounds like your gwt is using
plain-old html, and not a jsp, so I think the dispatcher would be over
kill.

So, in summary, I think you're doing it right! :)

jayanth

unread,
Mar 9, 2010, 1:12:42 PM3/9/10
to Google Web Toolkit
Thanks for the response. I however do not understand what you mean by
"sounds like your gwt is using plain-old html, and not a jsp". The
redirect I am performing is to the host page (initial html page that
invokes the GWT application). Can this be a jsp instead of a html?

Also, the difficulty I am encountering with the sendRedirect or
request dispatcher approach is that once a user has signed out of the
application, I have a "login again" link which invokes the same
AuthenticatorServlet which redirects to the GWT initial html page and
this redirect fails with a message that the "response has already been
committed". I am essentially looking for some technique to avoid this
message upon second login from the user.

Thanks.

> > Any help is appreciated. Thanks.- Hide quoted text -
>
> - Show quoted text -

Robert J. Carr

unread,
Mar 9, 2010, 1:24:41 PM3/9/10
to google-we...@googlegroups.com
> Thanks for the response. I however do not understand what you mean by
> "sounds like your gwt is using plain-old html, and not a jsp". The
> redirect I am performing is to the host page (initial html page that
> invokes the GWT application). Can this be a jsp instead of a html?

Sure, your gwt doesn't care what it is embedded in, html, jsp, asp, php, etc.

> Also, the difficulty I am encountering with the sendRedirect or
> request dispatcher approach is that once a user has signed out of the
> application, I have a "login again" link which invokes the same
> AuthenticatorServlet which redirects to the GWT initial html page and
> this redirect fails with a message that the "response has already been
> committed". I am essentially looking for some technique to avoid this
> message upon second login from the user.

This error usually means you've written to the output stream before
you send the redirect. I'm fairly certain if you avoid that you won't
get this error.

Good luck!

Reply all
Reply to author
Forward
0 new messages