Thursday, July 1, 2010

Re: How to refresh using filter

If you still need it I will leave more info about it:
import pt.quantum.padroes.client.services.LoginService;
import pt.quantum.padroes.client.services.LoginServiceAsync;
import pt.quantum.padroes.client.util.LogUtils;

import com.google.gwt.core.client.GWT;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.Timer;
import com.google.gwt.user.client.Event.NativePreviewEvent;
import com.google.gwt.user.client.Event.NativePreviewHandler;
import com.google.gwt.user.client.rpc.AsyncCallback;

The method for logging out

public static void loggingOut(){
        LoginServiceAsync service = GWT.create(LoginService.class);
        service.logout(new AsyncCallback<Void>() {
            @Override
            public void onFailure(Throwable caught) {
                caught.printStackTrace();

            }

            @Override
            public void onSuccess(Void result) {
                 LogUtils.info("Logging out at: " + new Date());
                Window.Location.replace("./../Login.html"+Constants.DEV_MODE);
            }
        });
    }

on server side

/**
     * sign out
     */
    public void logout() {
        PadroesSession padroesSession = PadroesSession.getInstance();
        String currentSessionId = getThreadLocalRequest().getSession().getId();
        PersonDTO user = padroesSession.getUser(currentSessionId);
        if(null!=user){
            ManageLogs.info(currentSessionId,"logout for user: "+user.getUsername());
            padroesSession.invalidate(currentSessionId);
        }
    }

PadroesSession is a simple hashMap of  http sessions ids and personDTOs with user usefull information to be used
on the client side.
 

:)


On Thu, Jul 1, 2010 at 5:50 PM, Bruno Santos <bruegosantos@gmail.com> wrote:
Thank you bruno, able to accomplish it, you saved my life

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.


--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment