Skip to content

Commit

Permalink
Have JaxRsService save response headers and, if Jersey does not handl…
Browse files Browse the repository at this point in the history
…e the request, restore the saved headers
  • Loading branch information
tjquinno committed Jan 23, 2025
1 parent 30f1bf6 commit 7a65217
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import io.helidon.http.HeaderNames;
import io.helidon.http.HeaderValues;
import io.helidon.http.InternalServerException;
import io.helidon.http.ServerResponseHeaders;
import io.helidon.http.Status;
import io.helidon.microprofile.server.HelidonHK2InjectionManagerFactory.InjectionManagerWrapper;
import io.helidon.webserver.KeyPerformanceIndicatorSupport;
Expand Down Expand Up @@ -201,6 +202,7 @@ private void handle(ServerRequest req, ServerResponse res) {
}

private void doHandle(Context ctx, ServerRequest req, ServerResponse res) {
ServerResponseHeaders savedResponseHeaders = ServerResponseHeaders.create(res.headers());
BaseUriRequestUri uris = BaseUriRequestUri.resolve(req);
ContainerRequest requestContext = new ContainerRequest(uris.baseUri,
uris.requestUri,
Expand Down Expand Up @@ -250,6 +252,7 @@ private void doHandle(Context ctx, ServerRequest req, ServerResponse res) {
if (res instanceof RoutingResponse routing) {
if (routing.reset()) {
res.status(Status.OK_200);
savedResponseHeaders.forEach(res::header);
routing.next();
}
}
Expand Down

0 comments on commit 7a65217

Please sign in to comment.