Class Http3ResponseWriter

java.lang.Object
org.mockserver.responsewriter.ResponseWriter
org.mockserver.netty.http3.Http3ResponseWriter
All Implemented Interfaces:
org.mockserver.responsewriter.StreamErrorWriter

public class Http3ResponseWriter extends org.mockserver.responsewriter.ResponseWriter implements org.mockserver.responsewriter.StreamErrorWriter
A ResponseWriter that serialises the MockServer HttpResponse as HTTP/3 frames and writes them to a QUIC stream channel.

This allows the standard request-processing pipeline (HttpState, HttpActionHandler) to write responses identically regardless of whether the request arrived via HTTP/1.1, HTTP/2, or HTTP/3.

Streaming support: when the response carries a StreamingBody (SSE, chunked proxy forwarding, LLM streaming), the headers are sent immediately and each chunk is forwarded as an HTTP/3 DATA frame. The QUIC stream output is shut down when the stream completes. Backpressure is implemented via StreamingBody.requestMore(): each chunk write completion triggers the next upstream read.

  • Field Summary

    Fields inherited from class org.mockserver.responsewriter.ResponseWriter

    configuration, mockServerLogger
  • Constructor Summary

    Constructors
    Constructor
    Description
    Http3ResponseWriter(org.mockserver.configuration.Configuration configuration, org.mockserver.logging.MockServerLogger mockServerLogger, io.netty.channel.ChannelHandlerContext ctx)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    sendResponse(org.mockserver.model.HttpRequest request, org.mockserver.model.HttpResponse response)
     
    void
    writeStreamError(long errorCode)
    Reset the QUIC stream with the supplied HTTP/3 error code (RESET_STREAM, RFC 9114 section 4.1).

    Methods inherited from class org.mockserver.responsewriter.ResponseWriter

    addConnectionHeader, writeResponse, writeResponse, writeResponse

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Http3ResponseWriter

      public Http3ResponseWriter(org.mockserver.configuration.Configuration configuration, org.mockserver.logging.MockServerLogger mockServerLogger, io.netty.channel.ChannelHandlerContext ctx)
  • Method Details

    • writeStreamError

      public void writeStreamError(long errorCode)
      Reset the QUIC stream with the supplied HTTP/3 error code (RESET_STREAM, RFC 9114 section 4.1). Only this request stream is reset; other streams on the QUIC connection are unaffected. No ByteBuf is allocated, so there is nothing to release.
      Specified by:
      writeStreamError in interface org.mockserver.responsewriter.StreamErrorWriter
    • sendResponse

      public void sendResponse(org.mockserver.model.HttpRequest request, org.mockserver.model.HttpResponse response)
      Specified by:
      sendResponse in class org.mockserver.responsewriter.ResponseWriter