From the course: Java EE 8: Web Services

Unlock the full course today

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

Your first RESTful web service

Your first RESTful web service - Java EE Tutorial

From the course: Java EE 8: Web Services

Start my 1-month free trial

Your first RESTful web service

- [Instructor] Now that you've gotten a taste of that web service life, how about we go a little deeper? You're going to add your own RESTful service endpoint to the archetype generated resource class. Come with me. Here we have the resource class called MyResource, placed in com.linkedin.learning.webservices.rest. This class was automatically generated while we're doing the archetype generation. Now we're going to add a simple method to this class that takes POJO and responds with a POJO. Remember, POJO means plain old Java object. I've gone ahead and created the POJO classes. Here we have SalutationRequest and SalutationResponse. SalutationRequest is a simple Java class, it implements Serializable. It has a field named salutation, here we have it on line 13. We encapsulate that field, we have the getter, and we have the setter, and then I used Eclipse to override the toString, hashCode, and equals methods. Same for the…

Contents