@ Override public byte [ ] asBytes ( ) throws IOException { try ( ServletInputStream stream = request . getInputStream ( ) ) { ByteArrayOutputStream array = new ByteArrayOutputStream ( stream . available ( ) ) ; return array . toByteArray ( ) ; } }
Reads entire request data as byte array . Do not use for large data sets to avoid memory issues .