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

Unlock the full course today

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

Define the API root

Define the API root

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

Start my 1-month free trial

Define the API root

- [Instructor] Let's start by creating the class that defines the root URI of your rest application. We create a class in the root of the application structure and call it rest config. This is our root of the application and here we're going to create our class rest config. Now remember we must sub class the application class like so. By extending the application class and annotate the class application path and pass it the base URI which is going to be API. And by passing it the string API we're passing it the base URI from which all rest resources are going to respond. Now all calls to API are directed to this location. This class does look a bit empty. That's fine for our application and for most simple applications. But as you advance you can add more specialized configurations into this class. So, for example, all resources are processed by default. By over writing the gate classes method you can specify which class to register by returning a set of those classes and within the…

Contents