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开发者_JS百科 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
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
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.
精彩评论