Package org.mockserver.mock
Class HttpState
java.lang.Object
org.mockserver.mock.HttpState
- Author:
- jamesdbloom
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionHttpState(Configuration configuration, MockServerLogger mockServerLogger, Scheduler scheduler) -
Method Summary
Modifier and TypeMethodDescriptionadd(Expectation... expectations) add(OpenAPIExpectation openAPIExpectation) allMatchingExpectation(HttpRequest request) voidclear(HttpRequest request) debugMismatch(HttpRequest request) explainUnmatched(HttpRequest request) Retrieves recent requests that matched no expectation and, for each, computes ranked closest-expectation diagnostics with remediation hints.findClosestMatchDiff(HttpRequest request) firstMatchingEarlyExpectation(HttpRequest headersOnly) Returns the first expectation whose matcher has respondBeforeBody=true, has no body matcher, and matches the supplied headers-only request.static IntegergetPort()Returns the pluggable state backend (G10 phase 2a).booleanhandle(HttpRequest request, ResponseWriter responseWriter, boolean warDeployment) voidSide-effect-free probe: returns the first matching expectation WITHOUT consuming the match (no Times decrement, no scenario transition, no responseInProgress, no metrics).voidpostProcess(Expectation expectation) voidreset()retrieve(HttpRequest request) voidsetControlPlaneAuthenticationHandler(AuthenticationHandler controlPlaneAuthenticationHandler) voidsetLlmCompletionService(LlmCompletionService llmCompletionService, LlmBackend llmBackend) Install the LLM completion service and default backend for runtime features that call out to an LLM (e.g.static voidstatic voidstatic voidstatic voidsetPort(HttpRequest request) voidstop()verify(Verification verification) voidverify(Verification verification, Consumer<String> resultConsumer) verify(VerificationSequence verification) voidverify(VerificationSequence verificationSequence, Consumer<String> resultConsumer)
-
Field Details
-
LOG_SEPARATOR
-
PATH_PREFIX
- See Also:
-
-
Constructor Details
-
HttpState
public HttpState(Configuration configuration, MockServerLogger mockServerLogger, Scheduler scheduler)
-
-
Method Details
-
setPort
-
setPort
-
setPort
-
setPort
-
getPort
-
getGrpcDescriptorStore
-
getFileStore
-
getCrudDispatcher
-
getControlPlaneAuthenticationHandler
-
setControlPlaneAuthenticationHandler
public void setControlPlaneAuthenticationHandler(AuthenticationHandler controlPlaneAuthenticationHandler) -
getConfiguration
-
setLlmCompletionService
public void setLlmCompletionService(LlmCompletionService llmCompletionService, LlmBackend llmBackend) Install the LLM completion service and default backend for runtime features that call out to an LLM (e.g. AI stub generation). Called by LifeCycle when a backend is configured; null-safe — when not called the stub generation endpoint falls back to template-based stubs. -
getMockServerLogger
-
clear
-
reset
public void reset() -
add
-
add
-
firstMatchingExpectation
-
peekFirstMatchingExpectation
Side-effect-free probe: returns the first matching expectation WITHOUT consuming the match (no Times decrement, no scenario transition, no responseInProgress, no metrics). Note: the underlying matcher evaluation may still emit INFO-level EXPECTATION_MATCHED / EXPECTATION_NOT_MATCHED diagnostic logs; this method avoids the consuming side-effects only. Used by the gRPC bidi router to inspect the action type before committing to a handler — the real consuming match happens separately on the committed path. -
firstMatchingEarlyExpectation
Returns the first expectation whose matcher has respondBeforeBody=true, has no body matcher, and matches the supplied headers-only request. Used by the early-response path that runs before the request body is aggregated. -
allMatchingExpectation
-
postProcess
-
findClosestMatchDiff
-
debugMismatch
-
explainUnmatched
Retrieves recent requests that matched no expectation and, for each, computes ranked closest-expectation diagnostics with remediation hints.- Parameters:
request- the control-plane request (body may contain{"limit":N})- Returns:
- a JSON response containing an array of unmatched requests with diagnostics
-
log
-
retrieve
-
verify
-
verify
-
verify
-
verify
-
handle
-
getWebSocketClientRegistry
-
getRequestMatchers
-
getMockServerLog
-
getScheduler
-
getUniqueLoopPreventionHeaderName
-
getUniqueLoopPreventionHeaderValue
-
stop
public void stop() -
getStateBackend
Returns the pluggable state backend (G10 phase 2a). The default implementation is in-memory with zero behaviour change.
-