gmunozfe commented on code in PR #4078:
URL:
https://github.com/apache/incubator-kie-kogito-runtimes/pull/4078#discussion_r2851866378
##########
kogito-codegen-modules/kogito-codegen-processes/src/main/resources/class-templates/RestResourceQuarkusTemplate.java:
##########
@@ -94,10 +100,32 @@ public class $Type$Resource {
}
@GET
- @Produces(MediaType.APPLICATION_JSON)
+ @Produces({MediaType.APPLICATION_JSON, MediaType.TEXT_HTML})
@Operation(operationId = "getAllProcessInstances_$name$", summary =
"$documentation$", description = "$processInstanceDescription$")
- public List<$Type$Output> getResources_$name$() {
- return processService.getProcessInstanceOutput(process);
+ public Response getResources_$name$(@Context HttpHeaders headers) {
+ List<$Type$Output> out =
processService.getProcessInstanceOutput(process);
+ boolean wantsHtml = headers.getAcceptableMediaTypes()
+ .stream()
+ .anyMatch(mt -> mt.isCompatible(MediaType.TEXT_HTML_TYPE) &&
!mt.isWildcardType());
Review Comment:
Even this positive logic is more clear, and easy to maintain, if you want to
consider it:
```
boolean wantsHtml = headers.getAcceptableMediaTypes()
.stream()
.anyMatch(mt -> mt.getType().equals("text")
&& mt.getSubtype().equals("html"));
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]