When can I set cookies?

245 views
Skip to first unread message

OlivierMatt

unread,
Apr 11, 2007, 9:19:28 AM4/11/07
to Google Web Toolkit
Dear Developers,

My GWT application needs to store cookies and I found that I should
use Cookies.setCookie(...) (from com.google.gwt.user.client.Cookies).

These calls to setCookie are performed by a service at some time by my
RemoteServiceServlet. These calls to setCookie make the call fail on
the client side.

So my question is WHY ? I have read somewhere that cookies are
transfered on the HTTP header so I wonder what the
Cookies.setCookie(...) really does. When can I set cookies and what is
the right way to achieve it?

If you have any idea or can provide interesting material, just let me
know.

Sincerely,

Olivier MATT

Reinier Zwitserloot

unread,
Apr 11, 2007, 5:14:15 PM4/11/07
to Google Web Toolkit
You really should set up your eclipse or other IDE to allow you direct
introspection of GWT source.

Cookies.setCookie and Cookies.getCookie are light sugar over
javascript's cookie setting and getting methods.

Hence your statement that they 'fail' is a bit weird. How are they
failing?

(There are two ways to set/get cookies; one is through HTTP headers,
the other is through javascript. GWT's cookies class uses javascript.
This is almost always better for both security and performance, and
it's far less complicated for GWT at least, to do it that way).

More info on javascript cookie access here: http://www.quirksmode.org/js/cookies.html

OlivierMatt

unread,
Apr 12, 2007, 4:11:00 AM4/12/07
to Google Web Toolkit
Hi Reinier,

Here's what I get in the server logs :

[WARN] StandardContext[]Exception while dispatching incoming RPC call
java.lang.UnsatisfiedLinkError:
com.google.gwt.user.client.Cookies.setCookie(Ljava/lang/String;Ljava/
lang/String;JLjava/lang/String;Ljava/lang/String;Z)V
at com.google.gwt.user.client.Cookies.setCookie(Cookies.java:64)
at com.google.gwt.user.client.Cookies.setCookie(Cookies.java:49)
at
xft.oli.test.server.TaskServiceImpl.OpenConnection(TaskServiceImpl.java:
118)
at
com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:
281)
at
com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost(RemoteServiceServlet.java:
167)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at
com.google.gwt.dev.shell.GWTShellServlet.service(GWTShellServlet.java:
248)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
237)

That's trully strange. It seems that many other GWT users have been
faced to the same problem and they never got an answer on this group.

OlivierMatt

unread,
Apr 12, 2007, 4:26:18 AM4/12/07
to Google Web Toolkit
By the way, I am trying to configure my Eclipse and I tried to set the
source path for the GWT. In which JAR can I find the sources for the
windows release?
On the GWT official webpage, they affirm that the sources are already
contained inside on the JARs but no source attachment can be found
inside {gwt-dev-windows, gwt-servlet, gwt-user}

Any idea?

Reinier Zwitserloot

unread,
Apr 12, 2007, 10:57:59 AM4/12/07
to Google Web Toolkit
They probably didn't get an answer because the answer is pretty much
on page one of the FAQ.

read the 'getting started guide'. good luck!

OlivierMatt

unread,
Apr 13, 2007, 8:03:34 AM4/13/07
to Google Web Toolkit
Yes well I finally downloaded the sources from the SVN. Thanks for
helping anyway. :)
Reply all
Reply to author
Forward
0 new messages