Added section about Jakarta EE + minor improvements

This commit is contained in:
Harald Kuhr 2024-01-30 10:40:22 +01:00
parent e07e7c3685
commit 210eeccb39

View File

@ -322,8 +322,8 @@ To depend on the JPEG and TIFF plugin in your IDE or program, add all of the fol
#### Deploying the plugins in a web app #### Deploying the plugins in a web app
Because the `ImageIO` plugin registry (the `IIORegistry`) is "VM global", it doesn't by default work well with Because the `ImageIO` plugin registry (the `IIORegistry`) is "VM global", it does not work well with
servlet contexts. This is especially evident if you load plugins from the `WEB-INF/lib` or `classes` folder. servlet contexts as-is. This is especially evident if you load plugins from the `WEB-INF/lib` or `classes` folder.
Unless you add `ImageIO.scanForPlugins()` somewhere in your code, the plugins might never be available at all. Unless you add `ImageIO.scanForPlugins()` somewhere in your code, the plugins might never be available at all.
In addition, servlet contexts dynamically loads and unloads classes (using a new class loader per context). In addition, servlet contexts dynamically loads and unloads classes (using a new class loader per context).
@ -359,6 +359,16 @@ or other ImageIO plugins as well.
Another safe option, is to place the JAR files in the application server's shared or common lib folder. Another safe option, is to place the JAR files in the application server's shared or common lib folder.
##### Jakarta Servlet Support
For those transitioning from the old `javax.servlet` to the new `jakarta.servlet` package, there is a separate
dependency available. It contains exactly the same servlet classes as mentioned above, but built against the new Jakarta EE
packages. The dependency has the same group name and identifier as before, but a `jakarta` *classifier* appended, to
distinguish it from the non-Jakarta package.
See the [Maven dependency example](#maven-dependency-example) for how to enable it with Maven.
Gradle or other build tools will have similar options.
#### Including the plugins in a "fat" JAR #### Including the plugins in a "fat" JAR
The recommended way to use the plugins, is just to include the JARs as-is in your project, through a Maven dependency or similar. The recommended way to use the plugins, is just to include the JARs as-is in your project, through a Maven dependency or similar.