GWT Tip: No Cookies Support

25 Sep

Q:  How do I maintain auth in my GWT web service.

A: Use a Dictionary class.

The Dictionary class is part of the i18n GWT package, but the big advantage it has is that it is resolved at runtime, rather than compile time. This means you can pass in values to your GWT app from the host page. In this case, the host page being a JSP.

What you want to do is create a script tag in a host JSP like this:

var services = {
service1 : “<%=response.encodeUrl( “[serviceURL1]”) %>”,
service2 : “<%=response.encodeUrl( “[serviceURL2]”) %>”

That means you can now use :

Dictionary services = Dictionary.getDictionary(“services”)

to get a lookup for your service URLs with JSessionID encoded and use that when you construct your stubs. This will give the service cals the same JSessionID as your JSP host page.

Note: In GWT 1.5 release added Cookies support

Leave a comment

Posted by on September 25, 2008 in GWT-TIPS


Tags: ,

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: