开发者

First Java EE Project using REST

开发者 https://www.devze.com 2023-01-29 07:21 出处:网络
I\'ve been going off of http://www.oracle.com/technetwork/articles/javase/index-137171.html and downloaded the files but I\'m a little lost since I\'ve never done this before.

I've been going off of http://www.oracle.com/technetwork/articles/javase/index-137171.html and downloaded the files but I'm a little lost since I've never done this before.

I've installed Tomcat and Eclipse Java EE IDE but I don't know what kind of project to use to create a webservice and how to load and compile the code to th开发者_如何学编程e service.

Am I going about this the right way in using eclipse?


That article is old. Since then, the Java standards committee created a new API named JAX-RS (The REST counterpart to JAX-WS). Like JAX-WS, this is meant to standardize REST web service layers.

Its reference implementation is Jersey, which supports JAX-RS 0.8, 1.0, and 1.1.

I understand that Apache CXF has support for JAX-RS 0.8, but it is unclear about 1.0/1.1 support.

JBoss has RESTEasy. However, it is not immediately clear which versions of JAX-RS are supported by RESTEasy.

Another popular JAX-RS framework is Restlet. Unfortunately, I can't open their site from here to say which versions of JAX-RS they support.


Here is an REST (JAX-RS) example I put together. You will probably find part 4 the most helpful:

  • Part 1 - The Database
  • Part 2 - Mapping the Database to JPA Entities
  • Part 3 - Mapping JPA entities to XML (using JAXB)
  • Part 4 - The RESTful Service
  • Part 5 - The Client


If all you're creating is a lightweight RESTful service you can also look at GlassFish which provides a simple http server for REST.


You'll create a web project to deploy a web service of any kind. It'll be packaged in a WAR and deployed on Tomcat.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号