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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What can you use to keep state?

A

a HttpSession object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Explain how Http Session works in 6 steps:

A
  1. User sends a Http Request (ex. opens site)
  2. A session is created (with id)
  3. Webb app now has a Http Response (cookie with session id)
  4. Http Request, now with session id in cookie
  5. Web app retrives the same session object from Session Objects
  6. 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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly