Package org.mockserver.mock.action.http
Class HttpActionHandler
java.lang.Object
org.mockserver.mock.action.http.HttpActionHandler
- Author:
- jamesdbloom
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final io.netty.util.AttributeKey<InetSocketAddress>static final StringInternal header carrying the upstream round-trip time (in milliseconds) on the LOGGEDFORWARDED_REQUESTresponse only. -
Constructor Summary
ConstructorsConstructorDescriptionHttpActionHandler(Configuration configuration, io.netty.channel.EventLoopGroup eventLoopGroup, HttpState httpStateHandler, List<ProxyConfiguration> proxyConfigurations, NettySslContextFactory nettySslContextFactory) -
Method Summary
Modifier and TypeMethodDescriptionstatic InetSocketAddressgetRemoteAddress(io.netty.channel.ChannelHandlerContext ctx) voidprocessAction(HttpRequest request, ResponseWriter responseWriter, io.netty.channel.ChannelHandlerContext ctx, Set<String> localAddresses, boolean proxyingRequest, boolean synchronous) voidprocessEarlyAction(HttpRequest request, Expectation expectation, io.netty.channel.ChannelHandlerContext ctx, ResponseWriter earlyResponseWriter, boolean synchronous) Dispatch an early-matched expectation before the request body has been received.static voidrecordLlmUsageMetrics(Provider provider, String model, Completion completion) Increment LLM token/cost Prometheus counters and record cost against the cost-budget circuit-breaker.static voidsetRemoteAddress(io.netty.channel.ChannelHandlerContext ctx, InetSocketAddress inetSocketAddress)
-
Field Details
-
REMOTE_SOCKET
-
RESPONSE_TIME_HEADER
Internal header carrying the upstream round-trip time (in milliseconds) on the LOGGEDFORWARDED_REQUESTresponse only. Mirrors thex-mockserver-streamed/x-mockserver-chunk-delays-msconvention: it is attached to a clone stored in the event log and is NEVER written to the real client. The LLM optimisation report reads it to populate per-call upstream latency.- See Also:
-
-
Constructor Details
-
HttpActionHandler
public HttpActionHandler(Configuration configuration, io.netty.channel.EventLoopGroup eventLoopGroup, HttpState httpStateHandler, List<ProxyConfiguration> proxyConfigurations, NettySslContextFactory nettySslContextFactory)
-
-
Method Details
-
processEarlyAction
public void processEarlyAction(HttpRequest request, Expectation expectation, io.netty.channel.ChannelHandlerContext ctx, ResponseWriter earlyResponseWriter, boolean synchronous) Dispatch an early-matched expectation before the request body has been received. SupportsAction.Type.RESPONSEandAction.Type.ERRORonly; other action types are rejected byRequestMatchers.validateRespondBeforeBodyat expectation-add time. -
processAction
public void processAction(HttpRequest request, ResponseWriter responseWriter, io.netty.channel.ChannelHandlerContext ctx, Set<String> localAddresses, boolean proxyingRequest, boolean synchronous) -
getHttpClient
-
getRemoteAddress
-
setRemoteAddress
public static void setRemoteAddress(io.netty.channel.ChannelHandlerContext ctx, InetSocketAddress inetSocketAddress) -
recordLlmUsageMetrics
Increment LLM token/cost Prometheus counters and record cost against the cost-budget circuit-breaker. Shared by both the forward path and the mock path (viaHttpLlmResponseActionHandler). Fail-soft.
-