From 3763a361fb8d6b8fcaff3154fdfaf0ba2daf8c94 Mon Sep 17 00:00:00 2001 From: Michael Simons Date: Mon, 16 Nov 2020 16:39:47 +0100 Subject: [PATCH 1/2] Fix instructions for enabling JSON-P. --- docs/se/health/01_health.adoc | 38 +++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/docs/se/health/01_health.adoc b/docs/se/health/01_health.adoc index 71cd58a3c39..e0979d7f79e 100644 --- a/docs/se/health/01_health.adoc +++ b/docs/se/health/01_health.adoc @@ -43,10 +43,15 @@ A typical health check combines the statuses of all the dependencies that === Prerequisites -Declare the following dependency in your project: +Declare the following dependencies in your project: [source,xml] ---- + + io.helidon.media + helidon-media-jsonp + + io.helidon.health helidon-health @@ -139,6 +144,17 @@ NOTE: Health check requires the `JSON-P` support to be enabled. See the example === Example +[source,java] +.Enable JSON-P support on the server +---- +WebServer server = WebServer.builder(createRouting(config)) // <.> + .addMediaSupport(JsonpSupport.create()) // <.> + .build(); +---- +<.> Your routing, as shown below. +<.> Enable support for `JSON-P`. + + [source,java] .Register a custom health check: ---- @@ -146,17 +162,15 @@ HealthSupport health = HealthSupport.builder() .addLiveness(() -> HealthCheckResponse.named("exampleHealthCheck") .up() .withData("time", System.currentTimeMillis()) - .build()) // <1> + .build()) // <.> .build(); Routing.builder() - .register(JsonSupport.create()) // <2> - .register(health) // <3> + .register(health) // <.> .build(); ---- -<1> Add a custom health check. This example returns `UP` and current time. -<2> Enable support for `JSON`. -<3> Register health support with web server routing (adds the `/health` +<.> Add a custom health check. This example returns `UP` and current time. +<.> Register health support with web server routing (adds the `/health` endpoint). TIP: Balance collecting a lot of information with the need to avoid overloading @@ -192,18 +206,16 @@ A set of built-in health checks can be optionally enabled to report various [source,java] ---- HealthSupport health = HealthSupport.builder() - .addLiveness(HealthChecks.healthChecks()) // <1> + .addLiveness(HealthChecks.healthChecks()) // <.> .build(); Routing.builder() - .register(JsonSupport.create()) // <2> - .register(health) // <3> + .register(health) // <.> .build(); ---- -<1> Add built-in health checks (requires the `helidon-health-checks` +<.> Add built-in health checks (requires the `helidon-health-checks` dependency). -<2> Register the `JSON-P` support in the WebServer routing. -<3> Register the created health support with web server routing (adds the +<.> Register the created health support with web server routing (adds the `/health` endpoint). [source,json] From 78a3c690fc0fb251014a0786b2f0fddd02fe506a Mon Sep 17 00:00:00 2001 From: Michael Simons Date: Thu, 19 Nov 2020 16:20:04 +0100 Subject: [PATCH 2/2] Remove unnecessary steps. --- docs/se/health/01_health.adoc | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/docs/se/health/01_health.adoc b/docs/se/health/01_health.adoc index e0979d7f79e..5f3e0bf8f34 100644 --- a/docs/se/health/01_health.adoc +++ b/docs/se/health/01_health.adoc @@ -43,15 +43,10 @@ A typical health check combines the statuses of all the dependencies that === Prerequisites -Declare the following dependencies in your project: +Declare the following dependency in your project: [source,xml] ---- - - io.helidon.media - helidon-media-jsonp - - io.helidon.health helidon-health @@ -139,22 +134,6 @@ HealthSupport health = HealthSupport.builder() .build(); ---- -NOTE: Health check requires the `JSON-P` support to be enabled. See the example - below. - -=== Example - -[source,java] -.Enable JSON-P support on the server ----- -WebServer server = WebServer.builder(createRouting(config)) // <.> - .addMediaSupport(JsonpSupport.create()) // <.> - .build(); ----- -<.> Your routing, as shown below. -<.> Enable support for `JSON-P`. - - [source,java] .Register a custom health check: ----