Hello,

I'm trying to write some code that will let me manage cookies from
with in the GWT that will set, show, and delete cookies.  However, I'm
unable to create the cookie via gwt on either Firefox 3.5.6 or Opera
10.10 (both on Linux).

My code is:

public class CookieMonster implements EntryPoint {
        private String name = new String("SampleCookie");
        private String value = new String("Raw");
        private Date expires = new Date(System.currentTimeMillis() + 10000 );
        private String domain = new String("blah.net");
        private String path = new String("/");
        private Boolean secure = new Boolean("false");
        private Button createButton = new Button("Create Cookie");
        private Button deleteButton = new Button("Delete Cookie");
        private Button showCookie = new Button("Show Cookie");
        private VerticalPanel mainPanel = new VerticalPanel();


        public void onModuleLoad() {

    createButton.addClickHandler(new ClickHandler() {
      public void onClick(ClickEvent event) {
                                Cookies.setCookie(name, value, expires, domain, 
path, secure);
                        }
    });
        mainPanel.add(createButton);

                showCookie.addClickHandler(new ClickHandler() {
                        public void onClick(ClickEvent event) {
                                String cookieContents = new String();
                                cookieContents = Cookies.getCookie(name);
                                Window.alert("Cookie is: " + cookieContents);
                        }
                });

                mainPanel.add(showCookie);


                deleteButton.addClickHandler(new ClickHandler() {
      public void onClick(ClickEvent event) {
                                Cookies.removeCookie(name);
                        }
    });

                mainPanel.add(deleteButton);
                RootPanel.get().add(mainPanel);

        }

}

Thanks in advance for your help.

Mark
-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.


Reply via email to