Stateful Webapp Flashcards
1
Q
Http is stateless, what does that mean?
A
When an HTTP request has been handled with an HTTP response, it is forgotten.
•The web app does not know if the next request is by the same user or another user
•HTTP requests are coming in all the time, totally independent from one another
We need a cookie, or something that remembers that we logged in.
2
Q
What can you use to keep state?
A
a HttpSession object
3
Q
Explain how Http Session works in 6 steps:
A
- User sends a Http Request (ex. opens site)
- A session is created (with id)
- Webb app now has a Http Response (cookie with session id)
- Http Request, now with session id in cookie
- Web app retrives the same session object from Session Objects
- And you get a Http response back.
This means you can add stuff in a basket, and check your basket. And your items are still there. If you log out or remove the cookie(session id) you have a clean slate.