From the course: Oracle Java Foundations

Unlock this course with a free trial

Join today to access over 24,000 courses taught by industry experts.

Create REST service

Create REST service - Java Tutorial

From the course: Oracle Java Foundations

Create REST service

(gentle upbeat music) - [Lecturer] Creating a REST service. You're going to create a new class and add it to your ShopApp project named ItemList to handle the new web request. For, here we go, public class ItemList implements Handler. That's an interface that you have to implement. That's the interface here, and this is part of the code that you downloaded. Now we're not going to go into how the code works or any of that. That's all covered in various courses like Web Service Courses where we teach this in more detail in the Java Learning Subscription. Our goal here is just to give you a taste of what this looks like. So public class ItemList implements Handler, we talked about interfaces before and therefore it must have a method called accept. The handler interface has a method called accept. So it is, at implementing the accept method. It'll accept a request and it'll generate a response. These are two different types of objects. ServerRequest object, ServerResponse object. A…

Contents