IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

JSF Java Discussion :

Page de login en Java EE (EJB, JSF - PrimeFaces)


Sujet :

JSF Java

  1. #1
    Nouveau Candidat au Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Décembre 2016
    Messages
    3
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Décembre 2016
    Messages : 3
    Points : 1
    Points
    1
    Par défaut Page de login en Java EE (EJB, JSF - PrimeFaces)
    Bonsoir ,
    je veux développer une page de login pour la gestion des roles , sachant que toutes les relations et les dépendances fonctionnent parfaitement.
    j'ai réussi a faire un pas avec un login prédéfini (admin,admin) mais je veux que ca récupère les donnés depuis la base ou j'ai une table personne(login,password,role) .Aussi j'ai un souci avec la redirection suivant les roles, j'ai deux projet ejb , web , merci d'avance

    Class Personne ejb :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    package metier.entities;
     
    import java.io.Serializable;
    import java.util.List;
     
    import javax.persistence.Entity;
    import javax.persistence.GeneratedValue;
    import javax.persistence.GenerationType;
    import javax.persistence.Id;
    import javax.persistence.ManyToMany;
    import javax.persistence.OneToMany;
     
    @Entity
    public class Personne implements Serializable {
    	/**
             * 
             */
    	private static final long serialVersionUID = 1L;
    	@Id
    	@GeneratedValue(strategy = GenerationType.IDENTITY)
    	private Long id;
    	private String researchId;
    	private String orcidId;
    	private String scopusAuthorId;
    	private String firstname;
    	private String lastname;
    	private String login;
    	private String password;
    	private String email;
    	private String tel;
    	private String role;
    	private String titre;
     
     
     
    	public String getTitre() {
    		return titre;
    	}
     
    	public void setTitre(String titre) {
    		this.titre = titre;
    	}
     
    	public String getRole() {
    		return role;
    	}
     
    	public void setRole(String role) {
    		this.role = role;
    	}
     
    	@ManyToMany
    	private List<Projet> projets;
     
    	public List<Projet> getProjets() {
    		return projets;
    	}
     
    	public void setProjets(List<Projet> projets) {
    		this.projets = projets;
    	}
     
    	@OneToMany(mappedBy = "personne")
    	private List<File> files;
     
    	public List<File> getFiles() {
    		return files;
    	}
     
    	public void setFiles(List<File> files) {
    		this.files = files;
    	}
     
    	public Long getId() {
    		return id;
    	}
     
    	public void setId(Long id) {
    		this.id = id;
    	}
     
    	public String getResearchId() {
    		return researchId;
    	}
     
    	public void setResearchId(String researchId) {
    		this.researchId = researchId;
    	}
     
    	public String getOrcidId() {
    		return orcidId;
    	}
     
    	public void setOrcidId(String orcidId) {
    		this.orcidId = orcidId;
    	}
     
    	public String getScopusAuthorId() {
    		return scopusAuthorId;
    	}
     
    	public void setScopusAuthorId(String scopusAuthorId) {
    		this.scopusAuthorId = scopusAuthorId;
    	}
     
    	public String getFirstname() {
    		return firstname;
    	}
     
    	public void setFirstname(String firstname) {
    		this.firstname = firstname;
    	}
     
    	public String getLastname() {
    		return lastname;
    	}
     
    	public void setLastname(String lastname) {
    		this.lastname = lastname;
    	}
     
    	public String getLogin() {
    		return login;
    	}
     
    	public void setLogin(String login) {
    		this.login = login;
    	}
     
    	public String getPassword() {
    		return password;
    	}
     
    	public void setPassword(String password) {
    		this.password = password;
    	}
     
    	public String getEmail() {
    		return email;
    	}
     
    	public void setEmail(String email) {
    		this.email = email;
    	}
     
    	public String getTel() {
    		return tel;
    	}
     
    	public void setTel(String tel) {
    		this.tel = tel;
    	}
     
    	public Personne(String researchId, String orcidId, String scopusAuthorId, String firstname, String lastname,
    			String login, String password, String email, String tel, String role, String titre) {
    		super();
    		this.researchId = researchId;
    		this.orcidId = orcidId;
    		this.scopusAuthorId = scopusAuthorId;
    		this.firstname = firstname;
    		this.lastname = lastname;
    		this.login = login;
    		this.password = password;
    		this.email = email;
    		this.tel = tel;
    		this.role = role;
    		this.titre = titre;
    	}
     
    	public Personne() {
    		super();
    	}
     
    	public Personne(String firstname, String lastname) {
    		super();
    		this.firstname = firstname;
    		this.lastname = lastname;
    	}
     
    }
    Class session PersonneImp ejb :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    package metier.session.impl;
     
    import java.util.List;
     
    import javax.ejb.Stateless;
    import javax.persistence.EntityManager;
    import javax.persistence.PersistenceContext;
    import javax.persistence.Query;
     
    import metier.entities.Personne;
    import metier.session.interfaces.IPersonneLocal;
    import metier.session.interfaces.IPersonneRemote;
     
    @Stateless(name = "PERSONNE")
    public class PersonneImpl implements IPersonneLocal, IPersonneRemote {
    	@PersistenceContext(unitName = "UP_LABAPP")
    	private EntityManager em;
     
    	@Override
    	public void addPersonne(Personne personne) {
    		em.persist(personne);
    	}
     
    	@SuppressWarnings("unchecked")
    	@Override
    	public List<Personne> getAllPersonne() {
    		Query req = em.createQuery("select p from Personne p");
    		return req.getResultList();
    	}
     
    	@Override
    	public Personne getPersonne(Long idP) {
    		Personne personne = em.find(Personne.class, idP);
    		return personne;
    	}
     
    	@Override
    	public void removePersonne(Long idP) {
    		Personne personne = em.find(Personne.class, idP);
    		em.remove(personne);
    	}
     
    	@Override
    	public void updatePersonne(Personne personne) {
    		Personne personne1 = em.find(Personne.class, personne.getId());
    		personne1.setResearchId(personne.getResearchId());
    		personne1.setEmail(personne.getEmail());
    		personne1.setFirstname(personne.getFirstname());
    		personne1.setLastname(personne.getLastname());
    		personne1.setLogin(personne.getLogin());
    		personne1.setOrcidId(personne.getOrcidId());
    		personne1.setPassword(personne.getPassword());
    		personne1.setResearchId(personne.getResearchId());
    		personne1.setTel(personne.getTel());
    		personne1.setScopusAuthorId(personne.getScopusAuthorId());
    		personne1.setRole(personne.getRole());
    		personne1.setTitre(personne.getTitre());
     
    		em.persist(personne1);
    	}
     
    	@Override
    	public Personne findPersonneByLogin(String l) {
     
    		return null;
    	}
     
    }
    Class MAnagedBean projet web :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    package web.mb;
     
    import java.util.ArrayList;
    import java.util.List;
     
    import javax.annotation.PostConstruct;
    import javax.ejb.EJB;
    import javax.faces.application.FacesMessage;
    import javax.faces.bean.ManagedBean;
    import javax.faces.bean.RequestScoped;
    import javax.faces.context.FacesContext;
    import javax.faces.event.ActionEvent;
    import javax.faces.model.SelectItem;
    import javax.faces.model.SelectItemGroup;
     
    import org.primefaces.context.RequestContext;
     
    import metier.entities.Personne;
    import metier.session.interfaces.IPersonneLocal;
     
    @ManagedBean(name = "personneMB")
    @RequestScoped
    public class PersonneMB {
    	@EJB
    	private IPersonneLocal metier;
    	private String researchId;
    	private String orcidId;
    	private String scopusAuthorId;
    	private String firstname;
    	private String lastname;
    	private String login;
    	private String password;
    	private String email;
    	private String tel;
    	private String role;
    	private String titre;
     
    	private List<SelectItem> titres;
     
     
    	public void SignIn(ActionEvent event) {
            RequestContext context = RequestContext.getCurrentInstance();
            FacesMessage message = null;
            boolean loggedIn = false;
     
            if(login != null && login.equals("admin") && password != null && password.equals("admin")) {
                loggedIn = true;
                message = new FacesMessage(FacesMessage.SEVERITY_INFO, "Welcome", login);
            } else {
                loggedIn = false;
                message = new FacesMessage(FacesMessage.SEVERITY_WARN, "Loggin Error", "Invalid credentials");
            }
     
            FacesContext.getCurrentInstance().addMessage(null, message);
            context.addCallbackParam("loggedIn", loggedIn);
        }   
     
    	@PostConstruct
    	public void init() {
    		SelectItemGroup titre1 = new SelectItemGroup("Chercheur IPT");
    		titre1.setSelectItems(new SelectItem[] { new SelectItem("Biologiste adjoint", "Biologiste adjoint"),
    				new SelectItem("Biologiste", "Biologiste"),
    				new SelectItem("Biologiste principal", "Biologiste principal") });
    		SelectItemGroup titre2 = new SelectItemGroup("Universitaire");
    		titre2.setSelectItems(new SelectItem[] { new SelectItem("Professeur", "Professeur"),
    				new SelectItem("Maitre assistant", "Maitre assistant"),
    				new SelectItem("Maitre conferences", "Maitre conferences") });
    		SelectItemGroup titre3 = new SelectItemGroup("Etudiant");
    		titre3.setSelectItems(
    				new SelectItem[] { new SelectItem("Mastère/PFE", "Mastère/PFE"), new SelectItem("Thèse", "Thèse") });
    		titres = new ArrayList<SelectItem>();
    		titres.add(titre1);
    		titres.add(titre2);
    		titres.add(titre3);
    	}
     
    	public List<SelectItem> getTitres() {
    		return titres;
    	}
     
    	public void setTitres(List<SelectItem> titres) {
    		this.titres = titres;
    	}
     
    	public String addPersonne() {
    		metier.addPersonne(new Personne(researchId, orcidId, scopusAuthorId, firstname, lastname, login, password,
    				email, tel, role, titre));
    		return "success";
    	}
     
    	public List<Personne> getListPersone() {
    		return metier.getAllPersonne();
    	}
     
    	public String removePersonne(Personne personne) {
    		metier.removePersonne(personne.getId());
    		return "success";
    	}
     
    	public Personne findPersonne(Long idP) {
    		if (metier.getPersonne(idP) != null)
    			System.out.println("found nom : " + firstname);
    		else System.out.println("Not Found");
    		return metier.getPersonne(idP);
    	}
     
    	public String getResearchId() {
    		return researchId;
    	}
     
    	public void setResearchId(String researchId) {
    		this.researchId = researchId;
    	}
     
    	public String getOrcidId() {
    		return orcidId;
    	}
     
    	public void setOrcidId(String orcidId) {
    		this.orcidId = orcidId;
    	}
     
    	public String getScopusAuthorId() {
    		return scopusAuthorId;
    	}
     
    	public void setScopusAuthorId(String scopusAuthorId) {
    		this.scopusAuthorId = scopusAuthorId;
    	}
     
    	public String getFirstname() {
    		return firstname;
    	}
     
    	public void setFirstname(String firstname) {
    		this.firstname = firstname;
    	}
     
    	public String getLastname() {
    		return lastname;
    	}
     
    	public void setLastname(String lastname) {
    		this.lastname = lastname;
    	}
     
    	public String getLogin() {
    		return login;
    	}
     
    	public void setLogin(String login) {
    		this.login = login;
    	}
     
    	public String getPassword() {
    		return password;
    	}
     
    	public void setPassword(String password) {
    		this.password = password;
    	}
     
    	public String getEmail() {
    		return email;
    	}
     
    	public void setEmail(String email) {
    		this.email = email;
    	}
     
    	public String getTel() {
    		return tel;
    	}
     
    	public void setTel(String tel) {
    		this.tel = tel;
    	}
     
    	public String getRole() {
    		return role;
    	}
     
    	public void setRole(String role) {
    		this.role = role;
    	}
     
    	public String getTitre() {
    		return titre;
    	}
     
    	public void setTitre(String titre) {
    		this.titre = titre;
    	}
     
    }
    page login.xhtml web :

    Code xhtml : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml"
    	xmlns:ui="http://java.sun.com/jsf/facelets"
    	xmlns:f="http://java.sun.com/jsf/core"
    	xmlns:h="http://java.sun.com/jsf/html"
    	xmlns:p="http://primefaces.org/ui">
    <h:head>
    	<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
    	<title><ui:define name="title">Nom de l'application - Login</ui:define></title>
    </h:head>
    <h:body>
     
     
    	<h:form>
     
    		<p:growl id="growl" sticky="true" showDetail="true" life="3000" />
     
    		<p:dialog visible="true" header="Login" widgetVar="dlg"
    			resizable="false">
    			<h:panelGrid columns="2" cellpadding="5">
    				<h:outputLabel for="username" value="Username:" />
    				<p:inputText id="username" value="#{personneMB.login}"
    					required="true" label="username" />
     
    				<h:outputLabel for="password" value="Password:" />
    				<p:password id="password" value="#{personneMB.password}"
    					required="true" label="password" />
     
    				<f:facet name="footer">
    					<p:commandButton value="Login" update="growl"
    						actionListener="#{personneMB.SignIn}"
    						oncomplete="handleLoginRequest(xhr, status, args)" />
    				</f:facet>
    			</h:panelGrid>
    		</p:dialog>
    	</h:form>
     
    	<script type="text/javascript">
                    function handleLoginRequest(xhr, status, args) {
                            if (args.validationFailed || !args.loggedIn) {
                                    PF('dlg').jq.effect("shake", {
                                            times : 5
                                    }, 100);
                            } else {
                                    PF('dlg').hide();
                                    $('#loginLink').fadeOut();
                            }
                    }
            </script>
     
     
    </h:body>
    </html>

  2. #2
    Membre éprouvé
    Avatar de Cafeinoman
    Homme Profil pro
    Couteau suisse d'une PME
    Inscrit en
    Octobre 2012
    Messages
    628
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 37
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Couteau suisse d'une PME

    Informations forums :
    Inscription : Octobre 2012
    Messages : 628
    Points : 1 256
    Points
    1 256
    Par défaut
    Salut,

    comme tu utilise des ejbs, je suppose que tu est dans un serveur d'application. Donc pous l'authentification, mieux vaut utiliser JAAS, qui est la spec java ee prévue pour. En gros, elle délègue là tuyauterie au container. Ca nécessite, entre autre, quelques configuration côté serveurs, notamment pour définir comment et où sont stocker les infos, et côté appli web dans ton web.xml. Regarde selon ton serveur sur sa documentation, tu devrais trouver les grandes lignes.
    «Dieu ne joue pas aux dés.» - Albert Einstein. Et pan! 30 ans de retard dans la théorie quantique!
    «Tout n'est pas politique, mais la politique s'intéresse à tout.» - Nicolas Machiavel. Et surtout à ceux qui ne s'y intéressent pas.

  3. #3
    Nouveau Candidat au Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Décembre 2016
    Messages
    3
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Décembre 2016
    Messages : 3
    Points : 1
    Points
    1
    Par défaut
    Merci pour votre reponse , mais je vois pas comment integrer JAAS a mon application , les tutorials que je trouve sont generale et compliqué , veuillez svp me guider encore . voir comment adapter JAAS a mon exemple

  4. #4
    Membre éprouvé
    Avatar de Cafeinoman
    Homme Profil pro
    Couteau suisse d'une PME
    Inscrit en
    Octobre 2012
    Messages
    628
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 37
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Couteau suisse d'une PME

    Informations forums :
    Inscription : Octobre 2012
    Messages : 628
    Points : 1 256
    Points
    1 256
    Par défaut
    Dans ce cas, j'ai besoin de savoir quel serveur d'application tu utilises, et que tu publie ton web.xml. Si tu utilise jboss/wildfly, joint aussi ton standalone.xml. Pour un autre serveur par contre, je ne pourrais pas t'aider...
    «Dieu ne joue pas aux dés.» - Albert Einstein. Et pan! 30 ans de retard dans la théorie quantique!
    «Tout n'est pas politique, mais la politique s'intéresse à tout.» - Nicolas Machiavel. Et surtout à ceux qui ne s'y intéressent pas.

  5. #5
    Nouveau Candidat au Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Décembre 2016
    Messages
    3
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Décembre 2016
    Messages : 3
    Points : 1
    Points
    1
    Par défaut
    j'utilise Wildfly 8.x , voici les fichier web.xml et standalone :

    standalone.xml

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    <?xml version="1.0" ?>
     
    <server xmlns="urn:jboss:domain:2.2">
     
        <extensions>
            <extension module="org.jboss.as.clustering.infinispan"/>
            <extension module="org.jboss.as.connector"/>
            <extension module="org.jboss.as.deployment-scanner"/>
            <extension module="org.jboss.as.ee"/>
            <extension module="org.jboss.as.ejb3"/>
            <extension module="org.jboss.as.jaxrs"/>
            <extension module="org.jboss.as.jdr"/>
            <extension module="org.jboss.as.jmx"/>
            <extension module="org.jboss.as.jpa"/>
            <extension module="org.jboss.as.jsf"/>
            <extension module="org.jboss.as.logging"/>
            <extension module="org.jboss.as.mail"/>
            <extension module="org.jboss.as.naming"/>
            <extension module="org.jboss.as.pojo"/>
            <extension module="org.jboss.as.remoting"/>
            <extension module="org.jboss.as.sar"/>
            <extension module="org.jboss.as.security"/>
            <extension module="org.jboss.as.transactions"/>
            <extension module="org.jboss.as.webservices"/>
            <extension module="org.jboss.as.weld"/>
            <extension module="org.wildfly.extension.batch"/>
            <extension module="org.wildfly.extension.io"/>
            <extension module="org.wildfly.extension.undertow"/>
        </extensions>
     
     
        <management>
            <security-realms>
                <security-realm name="ManagementRealm">
                    <authentication>
                        <local default-user="$local" skip-group-loading="true"/>
                        <properties path="mgmt-users.properties" relative-to="jboss.server.config.dir"/>
                    </authentication>
                    <authorization map-groups-to-roles="false">
                        <properties path="mgmt-groups.properties" relative-to="jboss.server.config.dir"/>
                    </authorization>
                </security-realm>
                <security-realm name="ApplicationRealm">
                    <authentication>
                        <local default-user="$local" allowed-users="*" skip-group-loading="true"/>
                        <properties path="application-users.properties" relative-to="jboss.server.config.dir"/>
                    </authentication>
                    <authorization>
                        <properties path="application-roles.properties" relative-to="jboss.server.config.dir"/>
                    </authorization>
                </security-realm>
            </security-realms>
            <audit-log>
                <formatters>
                    <json-formatter name="json-formatter"/>
                </formatters>
                <handlers>
                    <file-handler name="file" formatter="json-formatter" path="audit-log.log" relative-to="jboss.server.data.dir"/>
                </handlers>
                <logger log-boot="true" log-read-only="false" enabled="false">
                    <handlers>
                        <handler name="file"/>
                    </handlers>
                </logger>
            </audit-log>
            <management-interfaces>
                <http-interface security-realm="ManagementRealm" http-upgrade-enabled="true">
                    <socket-binding http="management-http"/>
                </http-interface>
            </management-interfaces>
            <access-control provider="simple">
                <role-mapping>
                    <role name="SuperUser">
                        <include>
                            <user name="$local"/>
                        </include>
                    </role>
                </role-mapping>
            </access-control>
        </management>
     
        <profile>
            <subsystem xmlns="urn:jboss:domain:logging:2.0">
                <console-handler name="CONSOLE">
                    <level name="INFO"/>
                    <formatter>
                        <named-formatter name="COLOR-PATTERN"/>
                    </formatter>
                </console-handler>
                <periodic-rotating-file-handler name="FILE" autoflush="true">
                    <formatter>
                        <named-formatter name="PATTERN"/>
                    </formatter>
                    <file relative-to="jboss.server.log.dir" path="server.log"/>
                    <suffix value=".yyyy-MM-dd"/>
                    <append value="true"/>
                </periodic-rotating-file-handler>
                <logger category="com.arjuna">
                    <level name="WARN"/>
                </logger>
                <logger category="org.apache.tomcat.util.modeler">
                    <level name="WARN"/>
                </logger>
                <logger category="org.jboss.as.config">
                    <level name="DEBUG"/>
                </logger>
                <logger category="sun.rmi">
                    <level name="WARN"/>
                </logger>
                <logger category="jacorb">
                    <level name="WARN"/>
                </logger>
                <logger category="jacorb.config">
                    <level name="ERROR"/>
                </logger>
                <root-logger>
                    <level name="INFO"/>
                    <handlers>
                        <handler name="CONSOLE"/>
                        <handler name="FILE"/>
                    </handlers>
                </root-logger>
                <formatter name="PATTERN">
                    <pattern-formatter pattern="%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
                </formatter>
                <formatter name="COLOR-PATTERN">
                    <pattern-formatter pattern="%K{level}%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
                </formatter>
            </subsystem>
            <subsystem xmlns="urn:jboss:domain:batch:1.0">
                <job-repository>
                    <in-memory/>
                </job-repository>
                <thread-pool>
                    <max-threads count="10"/>
                    <keepalive-time time="30" unit="seconds"/>
                </thread-pool>
            </subsystem>
            <subsystem xmlns="urn:jboss:domain:datasources:2.0">
                <datasources>
                    <datasource jta="true" jndi-name="java:/dsLabApp" pool-name="dsLabApp" enabled="true" use-ccm="true">
                        <connection-url>jdbc:mysql://localhost:3306/pasteur_db?useSSL=false</connection-url>
                        <driver-class>com.mysql.jdbc.Driver</driver-class>
                        <driver>mysql</driver>
                        <security>
                            <user-name>root</user-name>
                        </security>
                        <validation>
                            <validate-on-match>false</validate-on-match>
                            <background-validation>false</background-validation>
                        </validation>
                        <timeout>
                            <set-tx-query-timeout>false</set-tx-query-timeout>
                            <blocking-timeout-millis>0</blocking-timeout-millis>
                            <idle-timeout-minutes>0</idle-timeout-minutes>
                            <query-timeout>0</query-timeout>
                            <use-try-lock>0</use-try-lock>
                            <allocation-retry>0</allocation-retry>
                            <allocation-retry-wait-millis>0</allocation-retry-wait-millis>
                        </timeout>
                        <statement>
                            <share-prepared-statements>false</share-prepared-statements>
                        </statement>
                    </datasource>
                    <drivers>
                        <driver name="h2" module="com.h2database.h2">
                            <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
                        </driver>
                        <driver name="mysql" module="com.mysql"/>
                    </drivers>
                </datasources>
            </subsystem>
            <subsystem xmlns="urn:jboss:domain:deployment-scanner:2.0">
                <deployment-scanner path="deployments" relative-to="jboss.server.base.dir" scan-interval="5000"/>
            </subsystem>
            <subsystem xmlns="urn:jboss:domain:ee:2.0">
                <spec-descriptor-property-replacement>false</spec-descriptor-property-replacement>
                <concurrent>
                    <context-services>
                        <context-service name="default" jndi-name="java:jboss/ee/concurrency/context/default" use-transaction-setup-provider="true"/>
                    </context-services>
                    <managed-thread-factories>
                        <managed-thread-factory name="default" jndi-name="java:jboss/ee/concurrency/factory/default" context-service="default"/>
                    </managed-thread-factories>
                    <managed-executor-services>
                        <managed-executor-service name="default" jndi-name="java:jboss/ee/concurrency/executor/default" context-service="default" hung-task-threshold="60000" core-threads="5" max-threads="25" keepalive-time="5000"/>
                    </managed-executor-services>
                    <managed-scheduled-executor-services>
                        <managed-scheduled-executor-service name="default" jndi-name="java:jboss/ee/concurrency/scheduler/default" context-service="default" hung-task-threshold="60000" core-threads="2" keepalive-time="3000"/>
                    </managed-scheduled-executor-services>
                </concurrent>
            </subsystem>
            <subsystem xmlns="urn:jboss:domain:ejb3:2.0">
                <session-bean>
                    <stateful default-access-timeout="5000" cache-ref="simple" passivation-disabled-cache-ref="simple"/>
                    <singleton default-access-timeout="5000"/>
                </session-bean>
                <pools>
                    <bean-instance-pools>
                        <strict-max-pool name="slsb-strict-max-pool" max-pool-size="20" instance-acquisition-timeout="5" instance-acquisition-timeout-unit="MINUTES"/>
                        <strict-max-pool name="mdb-strict-max-pool" max-pool-size="20" instance-acquisition-timeout="5" instance-acquisition-timeout-unit="MINUTES"/>
                    </bean-instance-pools>
                </pools>
                <caches>
                    <cache name="simple"/>
                    <cache name="distributable" passivation-store-ref="infinispan" aliases="passivating clustered"/>
                </caches>
                <passivation-stores>
                    <passivation-store name="infinispan" cache-container="ejb" max-size="10000"/>
                </passivation-stores>
                <async thread-pool-name="default"/>
                <timer-service thread-pool-name="default" default-data-store="default-file-store">
                    <data-stores>
                        <file-data-store name="default-file-store" path="timer-service-data" relative-to="jboss.server.data.dir"/>
                    </data-stores>
                </timer-service>
                <remote connector-ref="http-remoting-connector" thread-pool-name="default"/>
                <thread-pools>
                    <thread-pool name="default">
                        <max-threads count="10"/>
                        <keepalive-time time="100" unit="milliseconds"/>
                    </thread-pool>
                </thread-pools>
                <default-security-domain value="other"/>
                <default-missing-method-permissions-deny-access value="true"/>
            </subsystem>
            <subsystem xmlns="urn:jboss:domain:io:1.1">
                <worker name="default"/>
                <buffer-pool name="default"/>
            </subsystem>
            <subsystem xmlns="urn:jboss:domain:infinispan:2.0">
                <cache-container name="web" default-cache="passivation" module="org.wildfly.clustering.web.infinispan">
                    <local-cache name="passivation" batching="true">
                        <file-store passivation="true" purge="false"/>
                    </local-cache>
                    <local-cache name="persistent" batching="true">
                        <file-store passivation="false" purge="false"/>
                    </local-cache>
                </cache-container>
                <cache-container name="ejb" default-cache="passivation" module="org.wildfly.clustering.ejb.infinispan" aliases="sfsb">
                    <local-cache name="passivation" batching="true">
                        <file-store passivation="true" purge="false"/>
                    </local-cache>
                    <local-cache name="persistent" batching="true">
                        <file-store passivation="false" purge="false"/>
                    </local-cache>
                </cache-container>
                <cache-container name="hibernate" default-cache="local-query" module="org.hibernate">
                    <local-cache name="entity">
                        <transaction mode="NON_XA"/>
                        <eviction strategy="LRU" max-entries="10000"/>
                        <expiration max-idle="100000"/>
                    </local-cache>
                    <local-cache name="local-query">
                        <transaction mode="NONE"/>
                        <eviction strategy="LRU" max-entries="10000"/>
                        <expiration max-idle="100000"/>
                    </local-cache>
                    <local-cache name="timestamps">
                        <transaction mode="NONE"/>
                        <eviction strategy="NONE"/>
                    </local-cache>
                </cache-container>
            </subsystem>
            <subsystem xmlns="urn:jboss:domain:jaxrs:1.0"/>
            <subsystem xmlns="urn:jboss:domain:jca:2.0">
                <archive-validation enabled="true" fail-on-error="true" fail-on-warn="false"/>
                <bean-validation enabled="true"/>
                <default-workmanager>
                    <short-running-threads>
                        <core-threads count="50"/>
                        <queue-length count="50"/>
                        <max-threads count="50"/>
                        <keepalive-time time="10" unit="seconds"/>
                    </short-running-threads>
                    <long-running-threads>
                        <core-threads count="50"/>
                        <queue-length count="50"/>
                        <max-threads count="50"/>
                        <keepalive-time time="10" unit="seconds"/>
                    </long-running-threads>
                </default-workmanager>
                <cached-connection-manager/>
            </subsystem>
            <subsystem xmlns="urn:jboss:domain:jdr:1.0"/>
            <subsystem xmlns="urn:jboss:domain:jmx:1.3">
                <expose-resolved-model/>
                <expose-expression-model/>
                <remoting-connector/>
            </subsystem>
            <subsystem xmlns="urn:jboss:domain:jpa:1.1">
                <jpa default-datasource="" default-extended-persistence-inheritance="DEEP"/>
            </subsystem>
            <subsystem xmlns="urn:jboss:domain:jsf:1.0"/>
            <subsystem xmlns="urn:jboss:domain:mail:2.0">
                <mail-session name="default" jndi-name="java:jboss/mail/Default">
                    <smtp-server outbound-socket-binding-ref="mail-smtp"/>
                </mail-session>
            </subsystem>
            <subsystem xmlns="urn:jboss:domain:naming:2.0">
                <remote-naming/>
            </subsystem>
            <subsystem xmlns="urn:jboss:domain:pojo:1.0"/>
            <subsystem xmlns="urn:jboss:domain:remoting:2.0">
                <endpoint worker="default"/>
                <http-connector name="http-remoting-connector" connector-ref="default" security-realm="ApplicationRealm"/>
            </subsystem>
            <subsystem xmlns="urn:jboss:domain:resource-adapters:2.0"/>
            <subsystem xmlns="urn:jboss:domain:sar:1.0"/>
            <subsystem xmlns="urn:jboss:domain:security:1.2">
                <security-domains>
                    <security-domain name="other" cache-type="default">
                        <authentication>
                            <login-module code="Remoting" flag="optional">
                                <module-option name="password-stacking" value="useFirstPass"/>
                            </login-module>
                            <login-module code="RealmDirect" flag="required">
                                <module-option name="password-stacking" value="useFirstPass"/>
                            </login-module>
                        </authentication>
                    </security-domain>
                    <security-domain name="jboss-web-policy" cache-type="default">
                        <authorization>
                            <policy-module code="Delegating" flag="required"/>
                        </authorization>
                    </security-domain>
                    <security-domain name="jboss-ejb-policy" cache-type="default">
                        <authorization>
                            <policy-module code="Delegating" flag="required"/>
                        </authorization>
                    </security-domain>
                </security-domains>
            </subsystem>
            <subsystem xmlns="urn:jboss:domain:transactions:2.0">
                <core-environment>
                    <process-id>
                        <uuid/>
                    </process-id>
                </core-environment>
                <recovery-environment socket-binding="txn-recovery-environment" status-socket-binding="txn-status-manager"/>
            </subsystem>
            <subsystem xmlns="urn:jboss:domain:undertow:1.2">
                <buffer-cache name="default"/>
                <server name="default-server">
                    <http-listener name="default" socket-binding="http"/>
                    <host name="default-host" alias="localhost">
                        <location name="/" handler="welcome-content"/>
                        <filter-ref name="server-header"/>
                        <filter-ref name="x-powered-by-header"/>
                    </host>
                </server>
                <servlet-container name="default">
                    <jsp-config/>
                    <websockets/>
                </servlet-container>
                <handlers>
                    <file name="welcome-content" path="${jboss.home.dir}/welcome-content"/>
                </handlers>
                <filters>
                    <response-header name="server-header" header-name="Server" header-value="WildFly/8"/>
                    <response-header name="x-powered-by-header" header-name="X-Powered-By" header-value="Undertow/1"/>
                </filters>
            </subsystem>
            <subsystem xmlns="urn:jboss:domain:webservices:1.2">
                <wsdl-host>${jboss.bind.address:127.0.0.1}</wsdl-host>
                <endpoint-config name="Standard-Endpoint-Config"/>
                <endpoint-config name="Recording-Endpoint-Config">
                    <pre-handler-chain name="recording-handlers" protocol-bindings="##SOAP11_HTTP ##SOAP11_HTTP_MTOM ##SOAP12_HTTP ##SOAP12_HTTP_MTOM">
                        <handler name="RecordingHandler" class="org.jboss.ws.common.invocation.RecordingServerHandler"/>
                    </pre-handler-chain>
                </endpoint-config>
                <client-config name="Standard-Client-Config"/>
            </subsystem>
            <subsystem xmlns="urn:jboss:domain:weld:2.0"/>
        </profile>
     
        <interfaces>
            <interface name="management">
                <inet-address value="${jboss.bind.address.management:127.0.0.1}"/>
            </interface>
            <interface name="public">
                <inet-address value="${jboss.bind.address:127.0.0.1}"/>
            </interface>
            <interface name="unsecure">
                <inet-address value="${jboss.bind.address.unsecure:127.0.0.1}"/>
            </interface>
        </interfaces>
     
        <socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}">
            <socket-binding name="management-http" interface="management" port="${jboss.management.http.port:9990}"/>
            <socket-binding name="management-https" interface="management" port="${jboss.management.https.port:9993}"/>
            <socket-binding name="ajp" port="${jboss.ajp.port:8009}"/>
            <socket-binding name="http" port="${jboss.http.port:8080}"/>
            <socket-binding name="https" port="${jboss.https.port:8443}"/>
            <socket-binding name="txn-recovery-environment" port="4712"/>
            <socket-binding name="txn-status-manager" port="4713"/>
            <outbound-socket-binding name="mail-smtp">
                <remote-destination host="localhost" port="25"/>
            </outbound-socket-binding>
        </socket-binding-group>
     
    </server>
    web.xml

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">
      <display-name>labAppWeb</display-name>
      <welcome-file-list>
        <welcome-file>index.html</welcome-file>
        <welcome-file>index.htm</welcome-file>
        <welcome-file>index.jsp</welcome-file>
        <welcome-file>default.html</welcome-file>
        <welcome-file>default.htm</welcome-file>
        <welcome-file>default.jsp</welcome-file>
      </welcome-file-list>
      <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
      </servlet>
      <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.xhtml</url-pattern>
      </servlet-mapping>
    </web-app>

Discussions similaires

  1. Réponses: 11
    Dernier message: 16/06/2016, 16h21
  2. Liaison entre JSF,EJB et BIRT
    Par hawaa dans le forum BIRT
    Réponses: 0
    Dernier message: 12/08/2009, 11h37
  3. combiner jsf+ejb sous netbeans
    Par kam81 dans le forum NetBeans
    Réponses: 0
    Dernier message: 02/09/2008, 14h31
  4. login et logout EJB/JSF/Glassfish
    Par doblern dans le forum JSF
    Réponses: 1
    Dernier message: 20/03/2008, 09h39
  5. Réponses: 3
    Dernier message: 12/02/2008, 16h19

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo