Skip to content
Snippets Groups Projects
Commit 85ff7df0 authored by Marius Dumitru Florea's avatar Marius Dumitru Florea
Browse files

XWIKI-19270: Add support for performing the PDF export using a browser running...

XWIKI-19270: Add support for performing the PDF export using a browser running in a Docker container
* Read smaller chunks from the PDF "stream" in order to avoid a BufferOverflow exception raised by the Tyrus (WebSocket) client used to communicate with the headless Chrome browser.
parent c9447d81
No related branches found
No related tags found
No related merge requests found
......@@ -35,6 +35,11 @@
*/
public class PrintToPDFInputStream extends InputStream
{
/**
* Read chunks of 1MB.
*/
private static final int BUFFER_SIZE = 1 << 20;
private IO io;
private String stream;
......@@ -84,7 +89,7 @@ private byte[] readBuffer()
return new byte[] {};
}
Read read = this.io.read(this.stream);
Read read = this.io.read(this.stream, null, BUFFER_SIZE);
this.finished = read.getEof() == Boolean.TRUE;
if (read.getBase64Encoded() == Boolean.TRUE) {
return Base64.getDecoder().decode(read.getData());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment