public Result renderRaw ( final byte [ ] bytes ) { Renderable renderable = new Renderable ( ) { @ Override public void render ( Context context , Result result ) { if ( result . getContentType ( ) == null ) { result . contentType ( Result . APPLICATION_OCTET_STREAM ) ; } ResponseStreams responseStreams = context . finalizeHeaders ( result ) ; try ( OutputStream outputStream = responseStreams . getOutputStream ( ) ) { outputStream . write ( bytes ) ; } catch ( IOException ioException ) { throw new InternalServerErrorException ( ioException ) ; } } } ; render ( renderable ) ; return this ; }
This method directly renders the byte array to the output . It completely bypasses any rendering engine .