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 - Java EE Tutorial
From the course: Java EE 8: Web Services
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.