Turn EJB into JSON web service

杀马特。学长 韩版系。学妹 提交于 2021-02-07 08:26:05

问题


I have turn EJB 3.1 into web-service. And now I need to create the JSON webservice for communication with JavaScript component. JavaScri[t component will use JSON version of the interface to communicate with the system and fetch the data needed. I can not use XML instead of JSON by the performance reason. I tried research myself but any solution was not found.

Please, have you any ideas, solutions or links how I can use EJB and JSON together.

Thanks! Best regards Artem


回答1:


Yes, JAX-RS is meant to do that - to let you expose RESTful services. Popular implementations are RestEasy and Jersey. They will in turn delegate to a JSON processor like Jackson.

You can use Jackson alone, but you'll have to manage many things manually. If you want to use SOAP with JSON (which is not the common choice), then check JAX-WS and the JSON Extension




回答2:


I've been using Restlet which is nicely designed, and solves most of the REST concerns (content-type negotiation, method routing, authentication, form handling...) for you. If you bump into problems, authors are quite responsive on their e-mail list.



来源:https://stackoverflow.com/questions/4994976/turn-ejb-into-json-web-service

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!