sincerely i didn't undertstand what's your problem?...
bye

2009/7/13 Michel <[email protected]>

>
> Hello
>
> I'm trying to store all users who are logged me my system to have a
> control in gwt
> the beginning I did get the user who is logging in through the class I
> served in
>
> package br.projeto.server;
> import br.projeto.client.User;
> import com.google.gwt.user.server.rpc.RemoteServiceServlet;
> import br.projeto.client.GWTService;
> import java.util.List;
> import javax.servlet.http.HttpServletRequest;
> import javax.servlet.http.HttpSession;
> import org.apache.catalina.Session;
>
>
> /**
>  *
>  * @author MICHEL
>  */
> public class GWTServiceImpl extends RemoteServiceServlet implements
>        GWTService {
>
>    private User usuario;
>
>    public User getUser(String vlogin, String vsenha) {
>
>        //System.out.print("Usuario  3333333-- ");
>        UsuarioDao objUserDao = new UsuarioDao();
>        usuario = objUserDao.procura(vlogin, vsenha);
>        HttpServletRequest httpSession = this.getThreadLocalRequest();
>        HttpSession session = httpSession.getSession();
>        session.setAttribute("usuario",usuario);
>        User usua = (User) session.getAttribute("usuario");
>     //   UsuariosAtivos.usuariosAtivos.add(usua);
>     //   System.out.print("Usuario "+usua.getUser());
>        //Logado(usuario);
>        return usuario;
>    }
>    public void Logado(User user) {
>
>       // System.out.print("Usuario ");
>                if(user != null){
>                        HttpSession httpSession =
> getThreadLocalRequest().getSession();
>            httpSession.setAttribute("usuario",user);
>            User usua = (User) httpSession.getAttribute("usuario");
>        //    System.out.print("Usuario ");
>                }
>        }
>    public List<User> getUsuario() {
>        return UsuariosAtivos.getUsuariosAtivos();
>    }
> }
>
>
>
>
>
> But when I try to get the users online for a class that triggered it
> and not using the web.xml users are getting this from mine null class
> and the following
>
> package br.projeto.server;
>
> /**
>  *
>  * @author MICHEL
>  */
> import br.projeto.client.User;
> import java.util.ArrayList;
> import java.util.List;
> import javax.servlet.http.*;
>
> public class UsuariosAtivos extends HttpServlet implements
> HttpSessionListener {
>
>    public UsuariosAtivos() {
>    }
>
>    public static int quantidadeSessoesAtivas;
>
>    public static List<User> usuariosAtivos = new ArrayList<User>();
>
>    public static List<User> getUsuariosAtivos()
>    {
>
>        return usuariosAtivos;
>
>    }
>
>    public void sessionCreated(HttpSessionEvent se) {
>
>        HttpSession httpSession = se.getSession();
>        User u  = (User) httpSession.getAttribute("usuario");
>        System.out.println("session created 3.1"+u.getUser());
>        if(u != null)
>        {
>            System.out.println("session created 3.1");
>        }
>        else{System.out.println("esta vazio");}
>        String nome = u.getUser();
>        usuariosAtivos.add(u);
>
>        quantidadeSessoesAtivas++;
>        System.out.println("session created 3 Michel");
>    }
>
>    public void sessionDestroyed(HttpSessionEvent se) {
>        HttpSession httpSession = se.getSession();
>        User usua = (User) httpSession.getAttribute("usuario");
>        usuariosAtivos.remove(usua);
>        quantidadeSessoesAtivas--;
>    }
> }
>
>
>
>
> And within the web.xml as follows
>
> <?xml version="1.0" encoding="UTF-8"?>
> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee";
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
> http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd";>
>    <servlet>
>        <servlet-name>GWTService</servlet-name>
>        <servlet-class>br.projeto.server.GWTServiceImpl</servlet-
> class>
>    </servlet>
>    <servlet-mapping>
>        <servlet-name>GWTService</servlet-name>
>        <url-pattern>/br.projeto.main/gwtservice</url-pattern>
>    </servlet-mapping>
>    <session-config>
>        <session-timeout>
>            30
>        </session-timeout>
>    </session-config>
>    <listener>
>           <listener-class>br.projeto.server.UsuariosAtivos</listener-
> class>
>    </listener>
>    <welcome-file-list>
>        <welcome-file>welcomeGWT.html</welcome-file>
>        </welcome-file-list>
>    </web-app>
>
> Will someone help me
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"GWT-Ext Developer Forum" 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/gwt-ext?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to