Created
May 21, 2013 12:13
-
-
Save carlosspohr/5619372 to your computer and use it in GitHub Desktop.
Exemplo de SessionScoped no VRaptor 3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package mas.bah.tche; | |
| import java.io.Serializable; | |
| import bar.Usuario; | |
| @Component | |
| @SessionScoped | |
| public class Bla implements Serializable{ | |
| private Usuario usuarioLogado; | |
| public void logout(){ | |
| this.usuarioLogado = null; | |
| } | |
| public void login(Usuario usuarioQueLogouComSucesso){ | |
| this.usuarioLogado = usuarioQueLogouComSucesso; | |
| } | |
| public boolean isLogado(){ | |
| // mais validações a seu gosto. | |
| return this.usuarioLogado != null && this.usuarioLogado.getIdUsuario() != null; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment