From the course: Java EE: RESTful Service with JAX-RS 2.0

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Add the media types

Add the media types

From the course: Java EE: RESTful Service with JAX-RS 2.0

Start my 1-month free trial

Add the media types

- [Instructor] Okay, we're back in our book resource class. Let's add some producer's annotations to the get all book method and let's hit, produce JSON data. So, we start by annotating the method, our producers, and we pass it our media type, application, JSON. And we're gonna annotate some more of our methods. The next method we're going to annotate is going to be our Save Book method. Now remember, this method produces and consumes JSON data. So, we're gonna annotate it with both produces and consumes annotations. So again, we are starting to annotate our media type, like so. And then we're going to consume our JSON, like so. Again, application JSON. Now we're going to finish off by annotating our, Get Book By ISBN method. This method produces JSON. So again, annotating this method in the same manner as the other ones. Like so. So, now our methods are annotated. We can deploy our application. And by using Postman, which we installed in a previous video, we can test our endpoints…

Contents