SlideShare une entreprise Scribd logo
1  sur  57
Télécharger pour lire hors ligne
Stateless is priceless




mercredi 7 mars 12
Thomas Recloux

                     Développeur / Architecte indépendant

                     @thomasrecloux

                     https://github.com/trecloux/

                     Ch’ti JUG (co) leader



mercredi 7 mars 12
Stateless
                     SessionLess is priceless




mercredi 7 mars 12
mercredi 7 mars 12
Session Http ?




mercredi 7 mars 12
Serveur


                     JSESSIONID=1337AZERTYUIOP




mercredi 7 mars 12
Serveur


                     JSESSIONID=1337AZERTYUIOP




                     JSESSIONID=1337AZERTYUIOP




mercredi 7 mars 12
Serveur

                                                 1337AZERTYUIOP
                                                                  user      com.myapp.User@45567
                     JSESSIONID=1337AZERTYUIOP
                                                                  roles   [CONFIGURATION, DICTATOR]




                     JSESSIONID=1337AZERTYUIOP




mercredi 7 mars 12
Serveur

                                                 1337AZERTYUIOP
                                                                  user      com.myapp.User@45567
                     JSESSIONID=1337AZERTYUIOP
                                                                  roles   [CONFIGURATION, DICTATOR]
                                                 DFGHH76434455
                                                                  user      com.myapp.User@24098
                     JSESSIONID=1337AZERTYUIOP                    roles              []




mercredi 7 mars 12
Pour quoi faire ?




mercredi 7 mars 12
1 - Authentification


                     En cas d’authentification par formulaire

                     Placer un objet marqueur en session pour
                     mémoriser l’authentification




mercredi 7 mars 12
2 - Etat conversationnel

                      Utiliser la session pour stocker l’état de la
                      conversation entre le client et le serveur

                      Exemples :

                        Panier

                        Entité en cours de modification

                        ....


mercredi 7 mars 12
Serveur
                     GET /petsearch?query=dog
                                                1337AZERTYUIOP




mercredi 7 mars 12
Serveur
                     GET /petsearch?query=dog
                                                1337AZERTYUIOP
                                                                 search   [Pet, Pet, Pet, Pet, Pet, Pet]




mercredi 7 mars 12
Serveur
                     GET /petsearch?query=dog
                                                1337AZERTYUIOP
                                                                 search   [Pet, Pet, Pet, Pet, Pet, Pet]

                          GET /pet?idx=2




mercredi 7 mars 12
Serveur
                     GET /petsearch?query=dog
                                                1337AZERTYUIOP
                                                                 search   [Pet, Pet, Pet, Pet, Pet, Pet]

                          GET /pet?idx=2                          pet      com.myapp.Pet@566577




mercredi 7 mars 12
Serveur
                     GET /petsearch?query=dog
                                                1337AZERTYUIOP
                                                                 search   [Pet, Pet, Pet, Pet, Pet, Pet]

                          GET /pet?idx=2                          pet      com.myapp.Pet@566577




                            POST /pet




mercredi 7 mars 12
3 - Cache

                     Eviter de recharger des objets depuis leur
                     système de stockage

                     Exemples :

                       Utilisateur, Roles

                       Objets fréquemment utilisés : Client,
                       Articles, .....



mercredi 7 mars 12
Il est ou le problème ?




mercredi 7 mars 12
1 - Répartition de
                          charge



mercredi 7 mars 12
A
                     session




mercredi 7 mars 12
A
                     session




                               B

                       ?




mercredi 7 mars 12
A
                                   session




                         Load
                       Balancer
                     1337AZE
                     RTYUIOP
                               A             B




mercredi 7 mars 12
A
                                      session




                         Load
                          Load
                       Balancer
                        Balancer
                     1337AZE
                       1337AZE
                     RTYUIOP
                                 A
                                  A
                                                B
                      RTYUIOP




mercredi 7 mars 12
2 - Tolérance aux pannes




mercredi 7 mars 12
A
                                      session




                         Load
                          Load
                       Balancer
                        Balancer
                     1337AZE
                       1337AZE
                     RTYUIOP
                                 A
                                  A
                                                B
                      RTYUIOP




mercredi 7 mars 12
A
                                      session




                         Load
                          Load
                       Balancer
                        Balancer
                     1337AZE
                       1337AZE
                     RTYUIOP
                                 A
                                  A
                                                B
                      RTYUIOP




mercredi 7 mars 12
A
                                   session




                         Load
                          Load
                       Balancer
                        Balancer
                     1337AZE
                     RTYUIOP
                               A             B

                                     ?




mercredi 7 mars 12
A
                                  session




                        Load
                         Load
                       Load
                        Load
                      Balancer
                       Balancer
                     Balancer
                      Balancer
                            A               B

                                  session




mercredi 7 mars 12
3 - Fourre tout

                     Difficile de gérer le cycle de vie des objets en
                     session

                     Syndrome de la session obèse, refactoring
                     complexe

                     Typage faible




mercredi 7 mars 12
4 - Scalabilité


                     En cas de forte charge, les sessions existantes
                     ne peuvent pas profiter de l’ajout de nouveaux
                     serveurs

                     Quelle taille mémoire provisionner pour ma
                     session ?




mercredi 7 mars 12
5 - Quelle durée de vie

                     Réglage du timeout de session : durée de
                     survie de la session après la dernière requête
                     de l’utilisateur

                     Trop court : la session ne survie pas à une
                     pause dans l’utilisation de l’application

                     Trop long : utilisation de ressources inutiles



mercredi 7 mars 12
6 - Mise à jour de
                          l’application

                     La session contient des objets complexes de
                     l’application, elle est donc liée à une version
                     de l’application

                     Procédures complexe de migration




mercredi 7 mars 12
7 - Onglets




mercredi 7 mars 12
Alors, on fait comment ?




mercredi 7 mars 12
Stocker l’état ailleurs




mercredi 7 mars 12
URL




mercredi 7 mars 12
Serveur
                     GET /petsearch?query=dog
                                                1337AZERTYUIOP




mercredi 7 mars 12
Serveur
                     GET /petsearch?query=dog
                                                1337AZERTYUIOP




mercredi 7 mars 12
Serveur
                     GET /petsearch?query=dog
                                                1337AZERTYUIOP



                     GET /pet/543/chimpanzee




mercredi 7 mars 12
Serveur
                     GET /petsearch?query=dog
                                                1337AZERTYUIOP



                     GET /pet/543/chimpanzee




                          POST /pet/543




mercredi 7 mars 12
Cookie

                     Echangé à chaque requête/réponse

                     Peut être signé

                     4Ko Maximum : privilégier l’échange
                     d’identifiants vs objets complexes

                     Peut être persistant

                     <!> Partagé entre les onglets


mercredi 7 mars 12
Champs caché


                     Ex : Mémoriser l’identifiant de l’entité en
                     cours de modification

                     Onglet friendly

                     <!> Vérifier les droits lors du GET et du POST




mercredi 7 mars 12
Etat coté client
                     Arbre DOM

                     Variables globales JavaScript

                     Applications «Single Page»

                       Ex : GWT

                     Stockage local HTML5

                       Web Storage, Indexed DB, Web SQL


mercredi 7 mars 12
Etat coté serveur


                     Base de données



                     Cache distribué




mercredi 7 mars 12
mercredi 7 mars 12
mercredi 7 mars 12
Spring MVC / Security




mercredi 7 mars 12
Authentification

                     Spring security 3.1 dispose d’un mode
                     «stateless»

                       Qui ne fonctionne pas en authentification
                       par formulaire

                     Solution : utiliser l’authentification
                     «Remember Me»

                       <!> Uniquement en mode «Token»


mercredi 7 mars 12
spring-security.xml
          <http .... create-session="stateless">
          	 ....
          	 <remember-me key="myRememberMeKey" />
          </http>



           login.jsp
          <form id='form'            Texte
                                      Texte
                action="<c:url value="/j_spring_security_check"/>"
                method="POST">
            <input type="hidden" value="true"
                   name="_spring_security_remember_me" />
          	 ...
          </form>




mercredi 7 mars 12
Entité en cours de
                          modification


                     Se passer du très utile @SessionAttributes




mercredi 7 mars 12
Serveur

                                               1337AZERTYUIOP
                                                                pet   com.myapp.Pet@566577

                     GET /pet/573/chimpanzee




                           POST /pet




mercredi 7 mars 12
Serveur

                                               1337AZERTYUIOP
                                                                pet   com.myapp.Pet@566577

                     GET /pet/573/chimpanzee




                           POST /pet




       1 - Récupérer l’attribut en session
       2 - «Binding» à partir des données du POST
       3 - Appel de la méthode du contrôleur

mercredi 7 mars 12
Serveur

                                               1337AZERTYUIOP
                                                                pet   com.myapp.Pet@566577

                     GET /pet/573/chimpanzee




                           POST /pet




       1 - Récupérer l’attribut en session
       1 - Charger l’entité depuis la base de données
       2 - «Binding» à partir des données du POST
       3 - Appel de la méthode du contrôleur
mercredi 7 mars 12
Une solution :

                       Annoter une méthode avec
                       @ModelAttribute permet de l’insérer dans
                       le traitement de la requête avant le
                       «binding»

                       Cette méthode peut prendre les même
                       paramètres qu’une méthode de Contrôleur




mercredi 7 mars 12
Démo




mercredi 7 mars 12
Questions ?




mercredi 7 mars 12

Contenu connexe

En vedette

Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 

En vedette (20)

Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 

Stateless is priceless

  • 2. Thomas Recloux Développeur / Architecte indépendant @thomasrecloux https://github.com/trecloux/ Ch’ti JUG (co) leader mercredi 7 mars 12
  • 3. Stateless SessionLess is priceless mercredi 7 mars 12
  • 6. Serveur JSESSIONID=1337AZERTYUIOP mercredi 7 mars 12
  • 7. Serveur JSESSIONID=1337AZERTYUIOP JSESSIONID=1337AZERTYUIOP mercredi 7 mars 12
  • 8. Serveur 1337AZERTYUIOP user com.myapp.User@45567 JSESSIONID=1337AZERTYUIOP roles [CONFIGURATION, DICTATOR] JSESSIONID=1337AZERTYUIOP mercredi 7 mars 12
  • 9. Serveur 1337AZERTYUIOP user com.myapp.User@45567 JSESSIONID=1337AZERTYUIOP roles [CONFIGURATION, DICTATOR] DFGHH76434455 user com.myapp.User@24098 JSESSIONID=1337AZERTYUIOP roles [] mercredi 7 mars 12
  • 10. Pour quoi faire ? mercredi 7 mars 12
  • 11. 1 - Authentification En cas d’authentification par formulaire Placer un objet marqueur en session pour mémoriser l’authentification mercredi 7 mars 12
  • 12. 2 - Etat conversationnel Utiliser la session pour stocker l’état de la conversation entre le client et le serveur Exemples : Panier Entité en cours de modification .... mercredi 7 mars 12
  • 13. Serveur GET /petsearch?query=dog 1337AZERTYUIOP mercredi 7 mars 12
  • 14. Serveur GET /petsearch?query=dog 1337AZERTYUIOP search [Pet, Pet, Pet, Pet, Pet, Pet] mercredi 7 mars 12
  • 15. Serveur GET /petsearch?query=dog 1337AZERTYUIOP search [Pet, Pet, Pet, Pet, Pet, Pet] GET /pet?idx=2 mercredi 7 mars 12
  • 16. Serveur GET /petsearch?query=dog 1337AZERTYUIOP search [Pet, Pet, Pet, Pet, Pet, Pet] GET /pet?idx=2 pet com.myapp.Pet@566577 mercredi 7 mars 12
  • 17. Serveur GET /petsearch?query=dog 1337AZERTYUIOP search [Pet, Pet, Pet, Pet, Pet, Pet] GET /pet?idx=2 pet com.myapp.Pet@566577 POST /pet mercredi 7 mars 12
  • 18. 3 - Cache Eviter de recharger des objets depuis leur système de stockage Exemples : Utilisateur, Roles Objets fréquemment utilisés : Client, Articles, ..... mercredi 7 mars 12
  • 19. Il est ou le problème ? mercredi 7 mars 12
  • 20. 1 - Répartition de charge mercredi 7 mars 12
  • 21. A session mercredi 7 mars 12
  • 22. A session B ? mercredi 7 mars 12
  • 23. A session Load Balancer 1337AZE RTYUIOP A B mercredi 7 mars 12
  • 24. A session Load Load Balancer Balancer 1337AZE 1337AZE RTYUIOP A A B RTYUIOP mercredi 7 mars 12
  • 25. 2 - Tolérance aux pannes mercredi 7 mars 12
  • 26. A session Load Load Balancer Balancer 1337AZE 1337AZE RTYUIOP A A B RTYUIOP mercredi 7 mars 12
  • 27. A session Load Load Balancer Balancer 1337AZE 1337AZE RTYUIOP A A B RTYUIOP mercredi 7 mars 12
  • 28. A session Load Load Balancer Balancer 1337AZE RTYUIOP A B ? mercredi 7 mars 12
  • 29. A session Load Load Load Load Balancer Balancer Balancer Balancer A B session mercredi 7 mars 12
  • 30. 3 - Fourre tout Difficile de gérer le cycle de vie des objets en session Syndrome de la session obèse, refactoring complexe Typage faible mercredi 7 mars 12
  • 31. 4 - Scalabilité En cas de forte charge, les sessions existantes ne peuvent pas profiter de l’ajout de nouveaux serveurs Quelle taille mémoire provisionner pour ma session ? mercredi 7 mars 12
  • 32. 5 - Quelle durée de vie Réglage du timeout de session : durée de survie de la session après la dernière requête de l’utilisateur Trop court : la session ne survie pas à une pause dans l’utilisation de l’application Trop long : utilisation de ressources inutiles mercredi 7 mars 12
  • 33. 6 - Mise à jour de l’application La session contient des objets complexes de l’application, elle est donc liée à une version de l’application Procédures complexe de migration mercredi 7 mars 12
  • 34. 7 - Onglets mercredi 7 mars 12
  • 35. Alors, on fait comment ? mercredi 7 mars 12
  • 38. Serveur GET /petsearch?query=dog 1337AZERTYUIOP mercredi 7 mars 12
  • 39. Serveur GET /petsearch?query=dog 1337AZERTYUIOP mercredi 7 mars 12
  • 40. Serveur GET /petsearch?query=dog 1337AZERTYUIOP GET /pet/543/chimpanzee mercredi 7 mars 12
  • 41. Serveur GET /petsearch?query=dog 1337AZERTYUIOP GET /pet/543/chimpanzee POST /pet/543 mercredi 7 mars 12
  • 42. Cookie Echangé à chaque requête/réponse Peut être signé 4Ko Maximum : privilégier l’échange d’identifiants vs objets complexes Peut être persistant <!> Partagé entre les onglets mercredi 7 mars 12
  • 43. Champs caché Ex : Mémoriser l’identifiant de l’entité en cours de modification Onglet friendly <!> Vérifier les droits lors du GET et du POST mercredi 7 mars 12
  • 44. Etat coté client Arbre DOM Variables globales JavaScript Applications «Single Page» Ex : GWT Stockage local HTML5 Web Storage, Indexed DB, Web SQL mercredi 7 mars 12
  • 45. Etat coté serveur Base de données Cache distribué mercredi 7 mars 12
  • 48. Spring MVC / Security mercredi 7 mars 12
  • 49. Authentification Spring security 3.1 dispose d’un mode «stateless» Qui ne fonctionne pas en authentification par formulaire Solution : utiliser l’authentification «Remember Me» <!> Uniquement en mode «Token» mercredi 7 mars 12
  • 50. spring-security.xml <http .... create-session="stateless"> .... <remember-me key="myRememberMeKey" /> </http> login.jsp <form id='form' Texte Texte action="<c:url value="/j_spring_security_check"/>" method="POST"> <input type="hidden" value="true" name="_spring_security_remember_me" /> ... </form> mercredi 7 mars 12
  • 51. Entité en cours de modification Se passer du très utile @SessionAttributes mercredi 7 mars 12
  • 52. Serveur 1337AZERTYUIOP pet com.myapp.Pet@566577 GET /pet/573/chimpanzee POST /pet mercredi 7 mars 12
  • 53. Serveur 1337AZERTYUIOP pet com.myapp.Pet@566577 GET /pet/573/chimpanzee POST /pet 1 - Récupérer l’attribut en session 2 - «Binding» à partir des données du POST 3 - Appel de la méthode du contrôleur mercredi 7 mars 12
  • 54. Serveur 1337AZERTYUIOP pet com.myapp.Pet@566577 GET /pet/573/chimpanzee POST /pet 1 - Récupérer l’attribut en session 1 - Charger l’entité depuis la base de données 2 - «Binding» à partir des données du POST 3 - Appel de la méthode du contrôleur mercredi 7 mars 12
  • 55. Une solution : Annoter une méthode avec @ModelAttribute permet de l’insérer dans le traitement de la requête avant le «binding» Cette méthode peut prendre les même paramètres qu’une méthode de Contrôleur mercredi 7 mars 12