Package org.mockserver.mock
Class CaptureProcessor
java.lang.Object
org.mockserver.mock.CaptureProcessor
Declarative capture-rule processor (WS2.2). When an expectation matches an
incoming request,
process(List, RequestDefinition) evaluates each
CaptureRule against the request and stores the extracted value into
scenario state, so a later request's response template can read it back via
scenario.get(name) (WS2.1).
The state is written to the live ScenarioManager resolved from
CrossProtocolEventBus.getInstance() — the same instance the
scenario template helper reads from — so a value captured here
is immediately visible to a subsequent template read and to matcher
matchesState checks.
Capture is best-effort and side-effect-only: a malformed expression, a missing
value, or the absence of a live ScenarioManager is logged at debug and
skipped, never failing the matched response. An expectation without capture
rules is entirely unaffected.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidprocess(List<CaptureRule> captureRules, RequestDefinition requestDefinition) Evaluates each capture rule against the request and writes the captured value into scenario state.
-
Method Details
-
process
Evaluates each capture rule against the request and writes the captured value into scenario state. No-op whencaptureRulesis null/empty, the request is not anHttpRequest, or no liveScenarioManageris available.
-