Add Jakarta REST Request and Response return support#828
Conversation
|
@arturobernalg Looks good overall. |
Represent buffered JSON response content as JsonNode internally and reuse it for entity decoding. This avoids repeatedly decoding the same JSON byte array while preserving the public Response readEntity behavior.
Done. I dropped ClientRequest / Request support and kept the change focused on Response. I also changed JSON Response entity decoding to parse into JsonNode once and reuse that tree for subsequent readEntity(...) calls. |
| private JsonNode jsonNode; | ||
| private boolean jsonParsed; | ||
|
|
||
| RestClientResponse(final HttpResponse response, final byte[] body, final ObjectMapper objectMapper) { |
There was a problem hiding this comment.
@arturobernalg It would be better to digest the body into JsonNode directly if the content is known to be JSON bypassing byte[] altogether.
| }); | ||
| } | ||
| if (rawType == Response.class) { | ||
| return submit(requestProducer, new BasicResponseConsumer<>(new BasicAsyncEntityConsumer())) |
There was a problem hiding this comment.
@arturobernalg See if one could useJsonNodeEntityFallbackConsumer here or a similar custom response consumer.
ok2c
left a comment
There was a problem hiding this comment.
@arturobernalg Please squash your changes
Support jakarta.ws.rs.core.Response as a resource method return type,
including access to response metadata and entity decoding. Responses
declared as Response are returned to the caller even for non-successful
status codes.