Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
public class LambdaHttpHandler implements RequestHandler<AwsProxyRequest, AwsProxyResponse> {
private static final Logger log = Logger.getLogger("quarkus.amazon.lambda.http");

private static final int BUFFER_SIZE = 8096;

private static Headers errorHeaders = new Headers();
static {
errorHeaders.putSingle("Content-Type", "application/json");
Expand Down Expand Up @@ -122,7 +124,7 @@ public void handleMessage(Object msg) {
responseBuilder.setBase64Encoded(true);
responseBuilder.setBody(Base64.getMimeEncoder().encodeToString(baos.toByteArray()));
} else {
responseBuilder.setBody(new String(baos.toByteArray(), "UTF-8"));
responseBuilder.setBody(new String(baos.toByteArray(), StandardCharsets.UTF_8));
}
}
future.complete(responseBuilder);
Expand Down Expand Up @@ -205,8 +207,8 @@ private AwsProxyResponse nettyDispatch(InetSocketAddress clientAddress, AwsProxy
}

private ByteArrayOutputStream createByteStream() {
ByteArrayOutputStream baos;// todo what is right size?
baos = new ByteArrayOutputStream(1000);
ByteArrayOutputStream baos;
baos = new ByteArrayOutputStream(BUFFER_SIZE);
return baos;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ public class BaseFunction {
protected static final String deploymentStatus;
protected static boolean started = false;

private static final int BUFFER_SIZE = 8096;

static {
StringWriter error = new StringWriter();
PrintWriter errorWriter = new PrintWriter(error, true);
Expand Down Expand Up @@ -106,7 +108,7 @@ protected HttpResponseMessage nettyDispatch(HttpRequestMessage<Optional<byte[]>>

private ByteArrayOutputStream createByteStream() {
ByteArrayOutputStream baos;
baos = new ByteArrayOutputStream(500);
baos = new ByteArrayOutputStream(BUFFER_SIZE);
return baos;
}

Expand Down Expand Up @@ -136,7 +138,6 @@ public void handleMessage(Object msg) {
if (msg instanceof HttpContent) {
HttpContent content = (HttpContent) msg;
if (baos == null) {
// todo what is right size?
baos = createByteStream();
}
int readable = content.content().readableBytes();
Expand Down