javalin / javalin

A simple and modern Java and Kotlin web framework

Home Page:https://javalin.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Brotli Compression not enabling

Musab520 opened this issue · comments

Hi, we are running Javalin on an Alpine Linux Image and brotli is not being enabled on startup even though we have the dependencies checked out. I'm stumped, so I could use some ideas.

Hi, could you try running calling com.aayushatharva.brotli4j.Brotli4jLoader.isAvailable() and checking the value? This should be logged at a WARNING level if it was false also.

Also, could be that you remove the dependency shading or similar, check for io.javalin.compression.CompressionStrategy.brotli4jPresent().

Alpine Linux should be supported...

After looking at our containers, and the code of brotli4j, we decided to just use

-Dbrotli4j.library.path=/usr/lib/libbrotlicommon.so.1

and reference the native lib for brotli directly without using any classpath loading.

most likely, we could have gotten this to work with our custom classpath prerfix, but this was just more straight forward

Great to see that you got it working!

Yes we did solve the issue, but also another thing we ran into was Brotli needs libstdc++ installed on the alpine linux image to run correctly so make sure thats included.