@Override
public void configure() throws Exception {
restConfiguration()
.component("servlet")
.enableCORS(true)
.contextPath("/")
.bindingMode(RestBindingMode.auto);
rest("/").get().consumes(MediaType.TEXT_PLAIN_VALUE)
.route().routeId("root")
.pipeline()
.bean("CustomerCamelRoute", "addTracer")
.to("http4:preference:8080/?httpClient.connectTimeout=1000&bridgeEndpoint=true©Headers=true&connectionClose=true")
.end()
.convertBodyTo(String.class)
.onException(HttpOperationFailedException.class)
.handled(true)
.process(this::handleHttpFailure)
.setHeader(Exchange.HTTP_RESPONSE_CODE, constant(503))
.end()
.onException(Exception.class)
.log(exceptionMessage().toString())
.handled(true)
.transform(simpleF(RESPONSE_STRING_FORMAT, exceptionMessage()))
.setHeader(Exchange.HTTP_RESPONSE_CODE, constant(503))
.end()
.transform(simpleF(RESPONSE_STRING_FORMAT, "${body}"))
.endRest();
}