Reputation: 12796
I understand web service provides all SOAP,WSDL support, and it stands at a higher level than Servlet.But if I just simply wanted to expose a rest api to allow another application(client) to make a few very easy queries which can be done even via web browser.
eg. http://serverIP/getUserInfo/123 where 123 is like user's id. Let's just assume user info is returned as json.
Questions are: Is there a big difference between implementing it in Servlet and Jersey? If the client application is written in .net, does that make any difference? Is it true that jax-ws allows you to specify the MIME type to be json while servlet's client has to parse the result? From performance perspective, which one is quicker? I noticed that normally, Jersey is meant not to be deployed on Tomcat while Servlet is.
Upvotes: 0
Views: 483
Reputation: 8417
Is there a big difference between implementing it in Servlet and Jersey?
Jersey is a framework that makes it a lot easier to write Restfull services. It uses the Servlet API, so it abstracts away a lot of the low level stuff.
You have to write a lot more code doing it using only the Servlet API, and the code has to deal with a lot of low level stuff that you can configure in a declarative way using Jersey.
If the client application is written in .net, does that make any difference?
No
Is it true that jax-ws allows you to specify the MIME type to be json while servlet's client has to parse the result?
Jersey lets you declare the mime type using annotations, but that's only for convenience, you still have to parse the incoming payload to check for correct mime type.
From performance perspective, which one is quicker?
Depends if you are able to write a faster implementation than the Jersey team. Jersey use servlets as well.
I noticed that normally, Jersey is meant not to be deployed on Tomcat while Servlet is.
Tomcat is a servlet container. Jersey uses the servlet API to communicate over HTTP. There are web-frameworks that don't use servlets, for instance Play framework.
Upvotes: 1