Is it possible to use restClient for JAX-RS endpoint?

Hello Team,

We have custom JAX-RS endpoint, and we wanted to use it in fragment using restClient.

restClient is working fine for headless endpoints but seems to be not working with JAX-RS custom endpoint

Thanks
Priyank Gajera

No idea, we never use restClient. What we do is add a TemplateContextContributor and inject the API into fragments. Basically as described here. https://liferay-studio.github.io/themes/samples/template-context-contributor/ But: @Reference OurService ourService; context.put("ourService", ourService); And in the template we use e.g: ${ourService.doWhatever()} We don't inject any rest services, we usually have service classes which are called then from jax-rs or freemarker code.

1 Answer

1

The restClient guy is designed to talk to Liferay’s RESTBuilder-based services. If you use RESTBuilder, the restClient should work fine. For just regular JAX-RS applications, I don’t know that it is meant to support that.