Session State and Data Sent with One Request

An application can associate state with a session while each request still supplies its own method, target, and values.

Source
Anbloq
Language
English
Created
Updated
Chapters
4
Reading time
1 min
In this article4 chapters
  1. Trace a saved view preference
  2. Distinguish persisted choices
  3. Trace which facts survive the end of one request
  4. Test session and request scopes independently

Trace a saved view preference

A user may select a theme once so later views can use it. A search query in one request still selects particular results. Request structure describes the per-request parts.

Distinguish persisted choices

A session-scoped preference can disappear when the session ends. A choice saved to an account can survive in another session if promised. Input, state, and output identifies the different state lifetimes.[1][2]

Trace which facts survive the end of one request

A request submits a search query and includes a session identifier. The query can apply to that request alone. A display preference stored in the session can apply to later requests from the same session if the application defines it. See overrides and settings.

Request input: current filter
Session state: chosen display preference
New session: follows defined defaults
Explicit filter remains part of the URL if encoded there

Test session and request scopes independently

Include two independent sessions to ensure state does not leak between them. Check that session-dependent responses follow the caching policy. Persist only state the application actually needs.

References

  1. IETF, RFC 9110: HTTP Semantics ↩
  2. WHATWG, HTML Living Standard: Forms ↩