问题
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