A practical guide to building REST endpoints that accept binary file uploads in Jakarta EE and Quarkus. Covers three approaches: the standard Jakarta REST 3.1 EntityPart API for portable multipart/form-data handling, the Quarkus-specific @RestForm with FileUpload for a more ergonomic experience, and raw application/octet-stream for single-file body uploads. Each approach includes working code examples, curl commands showing the wire format, and a pros/cons breakdown. Also covers security considerations: capping upload size, not trusting client-supplied Content-Type or filenames, streaming instead of buffering, and scanning uploaded content.
Table of contents
IntroductionA little bit of history1. The standard way: Jakarta REST EntityPart2. The Quarkus way: @RestForm and FileUpload3. Payload only: A single binary bodyA word on limits, safety, and securitySummary ComparisonConclusionWhat’s Next?957 Impressions