简体   繁体   中英

Liferay REST web service API


I'm trying to implement REST service in a liferay portlet. Found no way other than using JSON web services in liferay. I don't need to implement web services to interact with the database directly, meaning I dont want to build services to use Json web service. Is there anyway to implement REST web services in a liferay portlet without involving service building, more like a custom web service? Also provide any examples available if possible.
Thanks in advance.

For Spring based portlets, there's an excellent and still valid blog Using RESTFul services with Liferay that describes implementing REST services with Spring MVC controllers and Liferay PortalDelegateServlet .

Another option might be to handle the REST calls as resource requests (it. to implement a controller with resource mappings - @ResourceMapping ).

Since Liferay version 7.0 there is support in Liferay for deploying JAX-RS endpoints as OSGi services.

In Liferay 7.0 you need to use what is called RestExtender ( https://dev.liferay.com/es/develop/tutorials/-/knowledge_base/7-0/jax-ws-and-jax-rs )

From Liferay 7.1 version there is also support for JAX-RS OSGi Whiteboard, which also allows to deploy JAX-RS applications as services and adds a lot more flexibility ( https://osgi.org/specification/osgi.cmpn/7.0.0/service.jaxrs.html ) ( https://dev.liferay.com/es/develop/tutorials/-/knowledge_base/7-1/jax-rs )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM