Well there you go! so, I think we agree that the cookies in the response would be held in the http response headers then, right?
On Aug 2, 9:16 pm, Alex Luya <alexander.l...@gmail.com> wrote: > Hello,Nathan > Actually,we can set cookies into response,try this: > --------------------------------------------------------------------------- > --------------------------------------- > package com.ts.test.server; > > import javax.servlet.http.Cookie; > > import com.google.gwt.user.server.rpc.RemoteServiceServlet; > import com.ts.test.client.GreetingService; > > /** > * The server side implementation of the RPC service. > */ > @SuppressWarnings("serial") > public class GreetingServiceImpl extends RemoteServiceServlet implements > GreetingService > { > > public String greetServer(String input) > { > String serverInfo = getServletContext().getServerInfo(); > String userAgent = getThreadLocalRequest().getHeader("User-Agent"); > > Cookie cookie=new Cookie("ID","1234"); > getThreadLocalResponse().addCookie(cookie); > Cookie[] cookies=getThreadLocalRequest().getCookies(); > > Cookie clientCookie=null; > if(cookies!=null){ > clientCookie=cookies[0]; > } > > return "Hello, " + input+clientCookie.getValue() + "!<br><br>I > am running " + serverInfo > + ".<br><br>It looks like you are using:<br>" + userAgent; > }} > > --------------------------------------------------------------------------- > ---------------------------------------------------- > > Nathan Wells a écrit : > > > > > Alex, > > > 1) Use the Cookies class, as in > >http://lkamal.blogspot.com/2007/08/gwt-cookie-expire-time.html > > > 2) GWT-RPC has no mechanism for setting Cookies in the response. All > > cookie setting work is done purely client-side. In normal HTTP, you > > have the option of setting cookies in the response, but this is not an > > option in GWT-RPC, AFAIK. > > > 3) Yes, all cookies are transferred automatically, and they are held > > in the HTTP Request headers. > > > On Aug 1, 8:32 pm, Alex Luya <alexander.l...@gmail.com> wrote: > > >> 1,How to write a cookie into a response object? > > >> t is easy in JSP-Servelt programming,,but how to do it in RPC-Style > >> programming. > > >> 2,Where is cookies be hold when being tranfered to client? > > >> In servlet programming,I can write cookies into reponse object,and > >> client will receive it and write to text.But question is where this > >> object will be held when it is passing to client,HTTP Header or any > >> other places. > > >> 3,Does cookies be passed automaticlly? > >> I mean I can get cookies from reques object,so will cookied be passed > >> between server and client automaticlly through HTTP protocol,if so,as > >> question 2:where is be held when transfering? > > >> Thank you in advance. --~--~---------~--~----~------------~-------~--~----~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~----------~----~----~----~------~----~------~--~---