The story so far

In part 1 we covered getting our SE app started and the Jetty and Weld containers started to provide us with a servlet and CDI capabilities. Now we are going to setup JAX RS.

RESTful services

Do you want to add restful services to our application? Of course you do!

A fully working project to go along with this post is available here.

JAX RS Provider

I chose Jersey however it should be just as easy to get RESTeasy integrated. First off we need to tell Jetty about Jersey.

So in the above we setup our Jersey servlet and we set the parameter, the value is a class that we need to implement which returns a list of all the JAX RS resources in our application.

Our Service

Its also good idea to actually write the RESTful service.

So go ahead and POST to http://localhost:8080/rest/deed/good and you should receive a 201 Created response

You can also see the CDI lifecycle taking place on stdout.

In part 3 we will get JSF 2.0 working as well.