Add RequestContext to simplify creation of Request which requires SessionId and RequestId #201

Merged
lars.winzer merged 7 commits from feat/request-context-record into main 2026-03-24 18:29:28 +01:00
lars.winzer commented 2026-03-24 18:27:54 +01:00 (Migrated from git.scicore.unibas.ch)

Added RequestContext record to contain SessionId and RequestId.

Added RawRequest to serve as an intermediate object between parsing and creation of the PrimitiveRequest.

Refactored ProtocolParser to take a payload string and return RawRequest.

Refactored PrimitiveRequest and Request to contain RequestContext. Added getter methods to Request .

The reason for the refactoring and addition of a new intermediate type was the issue with PrimitiveRequest being immutable after creation.

Options were either to:

  1. Change the PrimitiveRequest to be a class. Subsequently, the RequestContext could be provided via a setter method.
  2. Add a new intermediate type to be created by the ProtocolParser. The SessionReader will then instantiate the PrimitiveRequest before calling the CommandParserDispatcher.

I opted for the second approach, as it was, in my eyes, the cleanest.

Closes #12

Added `RequestContext` record to contain `SessionId` and `RequestId`. Added `RawRequest` to serve as an intermediate object between parsing and creation of the `PrimitiveRequest`. Refactored `ProtocolParser` to take a payload string and return `RawRequest`. Refactored `PrimitiveRequest` and `Request` to contain `RequestContext`. Added getter methods to `Request` . The reason for the refactoring and addition of a new intermediate type was the issue with `PrimitiveRequest` being immutable after creation. Options were either to: 1. Change the `PrimitiveRequest` to be a class. Subsequently, the RequestContext could be provided via a setter method. 2. Add a new intermediate type to be created by the `ProtocolParser`. The `SessionReader` will then instantiate the `PrimitiveRequest` before calling the `CommandParserDispatcher`. I opted for the second approach, as it was, in my eyes, the cleanest. Closes #12
lars.winzer (Migrated from git.scicore.unibas.ch) scheduled this pull request to auto merge when all checks succeed 2026-03-24 18:27:58 +01:00
lars.winzer (Migrated from git.scicore.unibas.ch) merged commit 4234149b58 into main 2026-03-24 18:29:28 +01:00
lars.winzer commented 2026-03-24 18:29:29 +01:00 (Migrated from git.scicore.unibas.ch)

mentioned in commit 4234149b58

mentioned in commit 4234149b584e824ca4594bc97e213673e3712514
This repo is archived. You cannot comment on pull requests.
No Reviewers
1 Participants
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: University-of-Basel-Studentprojects/Programmierprojekt#201