source: ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/presentation/bean/AbstractVueBean.java @ 68

Last change on this file since 68 was 68, checked in by cbipsl, 14 years ago

commit v1 eccad

  • Property svn:executable set to *
File size: 957 bytes
Line 
1package org.medias.eccad.presentation.bean;
2
3import javax.faces.context.FacesContext;
4import javax.servlet.http.HttpSession;
5
6public class AbstractVueBean {
7        /**
8         * Permet de détecter si une session s'est terminée ou non
9         *
10         */
11        protected void controleSession() {
12                if (FacesContext.getCurrentInstance() == null)
13                        throw new DeconnectionException();
14               
15                if (FacesContext.getCurrentInstance().getExternalContext() == null)
16                        throw new DeconnectionException();
17               
18                if ((HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(false) == null)
19                        throw new DeconnectionException();
20               
21               
22                SessionBean sessionbean = (SessionBean)((HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(false)).getAttribute("sessionBean");
23               
24                if (sessionbean == null)
25                        throw new DeconnectionException();
26               
27                if (sessionbean.getEmail() == null || sessionbean.getEmail() == "")
28                        throw new DeconnectionException();
29        }
30}
Note: See TracBrowser for help on using the repository browser.