Hello everyone I'm new in GWT ... I would like to implement sessions
in my Web App Basically I want that a session starts at the click of a
button (handle an event) and ends at the click of another button
(other handle an event). It's possible?

Someone please, can you tell me how to do it step by step? You give me
a big help.

Is it Okay this code??:

Main (client-side):

Button b1 = new Button("b1"); b1.addClickHandler(new ClickHandler)
{ public voin onClick(){

          ......
         rpc.setSession(callback); //rpc call the service...

} }

Button b2 = new Button("b2"); b1.addClickHandler(new ClickHandler)
{ public voin onClick(){

          ......
         rpc.exitSession(callback);

} }

//------------------------------------------------------------------------------------

import com.google.gwt.user.client.rpc.RemoteService;

public interface MySession extends RemoteService {

public void setSession();

public void exitSession();

}

//------------------------------------------------------------------------------------

import com.google.gwt.user.client.rpc.AsyncCallback;

public interface MySessionAsync {

void setSession(AsyncCallback<Void> callback);

void exitSession(AsyncCallback<Void> callback);

}

//------------------------------------------------------------------------------------

import de.vogella.gwt.helloworld.client.MySession;

public class MySessionImpl extends RemoteServiceServlet implements
MySession {

HttpSession httpSession;
@Override

public void setSession() {
    httpSession = getThreadLocalRequest().getSession();

    httpSession = this.getThreadLocalRequest().getSession();
    httpSession.setAttribute("b", "1");

}

@Override
public void exitSession() {
      httpSession = this.getThreadLocalRequest().getSession();
      httpSession.invalidate(); // kill session

}
}

What I do is I connect with my Web application to another web page, if
I click the back button of my browser that I return to my web app with
the session still alive ... How can I do?

I hope I have explained well what my problem ...

Thank you and have a nice day

JD

-- 
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.

Reply via email to