Class ParsingErrorHandler
- Direct Known Subclasses:
ContextReportingParsingErrorHandler$,DefaultParsingErrorHandler$,TestParsingErrorHandler$
pekko.http.server.parsing-error-handler setting.
This is also the earliest public symbol that observes a rejected request, so it is what
observability tooling attaches to: the OpenTelemetry Java agent instruments handle to emit a
span for a request that never reaches the route handler
(open-telemetry/opentelemetry-java-instrumentation#5139).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract HttpResponsehandle(StatusCode status, ErrorInfo error, org.apache.pekko.event.LoggingAdapter log, ServerSettings settings) handle(StatusCode status, ErrorInfo error, org.apache.pekko.event.LoggingAdapter log, ServerSettings settings, IllegalRequestContext context) Called by the server for a request that failed to parse, with what is known about that request.
-
Constructor Details
-
ParsingErrorHandler
public ParsingErrorHandler()
-
-
Method Details
-
handle
public abstract HttpResponse handle(StatusCode status, ErrorInfo error, org.apache.pekko.event.LoggingAdapter log, ServerSettings settings) -
handle
public HttpResponse handle(StatusCode status, ErrorInfo error, org.apache.pekko.event.LoggingAdapter log, ServerSettings settings, IllegalRequestContext context) Called by the server for a request that failed to parse, with what is known about that request.The default implementation ignores
contextand delegates to the four-argumenthandle, so existing handlers keep working unchanged; override this method instead to make use of the context. The parameter is still worth passing for a handler that does not read it, because the arguments of this method are visible to anything instrumenting it: the OpenTelemetry Java agent has to name the span it emits for a rejected requestHTTPand report neitherhttp.request.methodnorurl.path, since the four-argument signature describes only the failure and never the request that caused it. See {@link https://github.com/apache/pekko-http/issues/1245}.Note that
DefaultParsingErrorHandlerdeliberately keeps implementing the four-argument method rather than this one, so that advice matching that signature keeps firing.- Parameters:
status- (undocumented)error- (undocumented)log- (undocumented)settings- (undocumented)context- (undocumented)- Returns:
- (undocumented)
- Since:
- 2.0.0
-