Package 

Class JavalinJackson

    • Constructor Detail

      • JavalinJackson

        JavalinJackson(ObjectMapper objectMapper, Boolean useVirtualThreads)
    • Method Detail

      • getMapper

         final <Error class: unknown class> getMapper()
      • writeToOutputStream

         Unit writeToOutputStream(Stream<?> stream, OutputStream outputStream)

        Javalin uses this method for io.javalin.http.Context.writeJsonStream. When implementing this method you are expected to consume stream one element at a time, convert that element to JSON, and write that element's corresponding JSON to the outputStream. The intent is to reduce the amount of memory used during transformation of a data stream to JSON.

        It is implied that the stream of objects will be transformed to an Array type in JSON. In other words, it is your responsibility to surround the output with [ and ].

        The outputStream will be a compressed output stream.

        The content type header will already be set to "application/json".

        Once Javalin calls this function, it will not participate any further in the response. It becomes your responsibility to deliver the remainder of the response to the outputStream.

        When your implementation returns from this function, assume that the underlying resources for the stream will be released.

      • fromJsonString

         <T extends Any> T fromJsonString(String json, Type targetType)

        If .fromJsonStream is not implemented, Javalin will use this method when mapping request bodies to JSON through io.javalin.http.Context.bodyAsClass. Regardless of if .fromJsonStream is implemented, Javalin will use this method for Validation and for WebSocket messaging.