0

I'd like to set the configuration property org.glassfish.jersey.server.ServerProperties.UNWRAP_COMPLETION_STAGE_IN_WRITER_ENABLE of Jersey to true.

I've read the Helidon documentation about configuring the server and tried to add the following to my microprofile-config.properties:

jersey.config.server.unwrap.completion.stage.writer.enable=true

But it looks like it is not accepted. How do I correctly set a configuration property for Jersey in Helidon MP?

Itchy
  • 2,263
  • 28
  • 41
  • 1
    First: are you using Helidon 2.3.0 or later? That configuration item is available in Jersey 2.34. Helidon 2.3.0 is the first Helidon version to include Jersey 2.34 (https://github.com/oracle/helidon/blob/2.3.0/CHANGELOG.md; https://github.com/oracle/helidon/pull/2917). – Laird Nelson Nov 03 '21 at 22:55
  • Next: You mention "my `microprofile-config.properties`": I want to make sure you mean your `/META-INF/microprofile-config.properties` classpath resource. You can also pass properties as System properties, which may be simpler in this case. – Laird Nelson Nov 03 '21 at 22:57
  • Yes I'm using Helidon 2.4.0 with Jersey 2.35. And yes I mean my `src/main/resources/META-INF/microprofile-config.properties` (this actually contains also the configuration for `server.static.classpath.location` which is working). And I've also tried `System.setProperty(ServerProperties.UNWRAP_COMPLETION_STAGE_IN_WRITER_ENABLE, "true");` before starting the server but it did not work neither. – Itchy Nov 04 '21 at 23:33
  • OK, thanks for that. We have a unit test showing that system properties set via MIcroProfile Config do make their way into Jersey (https://github.com/oracle/helidon/blob/master/microprofile/server/src/test/java/io/helidon/microprofile/server/JerseyPropertiesTest.java) so it should be possible. I'll look into this some more. – Laird Nelson Nov 05 '21 at 02:35
  • OK, looks like you'll need to follow these directions (https://eclipse-ee4j.github.io/jersey.github.io/documentation/latest/jersey-configuration.html#mp-config) bearing in mind that of course the Helidon MicroProfile Config implementation is already taken care of. – Laird Nelson Nov 12 '21 at 22:27
  • It worked! Thanks a lot. Do you want to write this as an answer (and not a comment) to the question so that I can accept it? – Itchy Nov 14 '21 at 22:28
  • Done; glad it works! – Laird Nelson Nov 15 '21 at 04:25

1 Answers1

2

In Helidon MP version 2.4.0, you'll need to follow Jersey's instructions for integrating with MicroProfile Config, bearing in mind that Helidon's MicroProfile Config implementation will already be taken care of so there's no need to duplicate that dependency.

In my opinion Helidon should take care of this for you, but in version 2.4.0 at least it does not.

Laird Nelson
  • 15,321
  • 19
  • 73
  • 127