From 63a982651870359c5279de18309ba6e8a942f06f Mon Sep 17 00:00:00 2001
From: Tomas Langer <tomas.langer@oracle.com>
Date: Sat, 9 Mar 2024 00:02:59 +0100
Subject: [PATCH] 4.x: Fix buffering of content in our Jersey integration.
 (#8461)

* Fix buffering of content in our Jersey integration.

* Replace old comment in JaxRsService.

Signed-off-by: Santiago Pericasgeertsen <santiago.pericasgeertsen@oracle.com>

* Attempt to fix TCK download.

Signed-off-by: Santiago Pericasgeertsen <santiago.pericasgeertsen@oracle.com>

* Also catch UncheckedIOException in test to handle broken pipes (#8462)

* Also catch UncheckedIOException in test.

Signed-off-by: Santiago Pericasgeertsen <santiago.pericasgeertsen@oracle.com>

* Attempt to fix TCK download.

Signed-off-by: Santiago Pericasgeertsen <santiago.pericasgeertsen@oracle.com>

---------

Signed-off-by: Santiago Pericasgeertsen <santiago.pericasgeertsen@oracle.com>

---------

Signed-off-by: Santiago Pericasgeertsen <santiago.pericasgeertsen@oracle.com>
Co-authored-by: Santiago Pericasgeertsen <santiago.pericasgeertsen@oracle.com>
---
 .../java/io/helidon/microprofile/server/JaxRsService.java | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/microprofile/server/src/main/java/io/helidon/microprofile/server/JaxRsService.java b/microprofile/server/src/main/java/io/helidon/microprofile/server/JaxRsService.java
index 04188e1c769..e268d372f05 100644
--- a/microprofile/server/src/main/java/io/helidon/microprofile/server/JaxRsService.java
+++ b/microprofile/server/src/main/java/io/helidon/microprofile/server/JaxRsService.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022, 2023 Oracle and/or its affiliates.
+ * Copyright (c) 2022, 2024 Oracle and/or its affiliates.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -190,7 +190,8 @@ private void doHandle(Context ctx, ServerRequest req, ServerResponse res) {
         ContainerRequest requestContext = new ContainerRequest(uris.baseUri,
                                                                uris.requestUri,
                                                                req.prologue().method().text(),
-                                                               new HelidonMpSecurityContext(), new MapPropertiesDelegate(),
+                                                               new HelidonMpSecurityContext(),
+                                                               new MapPropertiesDelegate(),
                                                                resourceConfig);
         /*
          MP CORS supports needs a way to obtain the UriInfo from the request context.
@@ -378,8 +379,7 @@ public void failure(Throwable throwable) {
 
         @Override
         public boolean enableResponseBuffering() {
-            // Jersey should not try to do the buffering
-            return false;
+            return true;        // enable buffering in Jersey
         }
 
         public void await() {