Creating the web service

Let's start by adding the required import statements to the top of the Main.groovy file after the package statement:

    package webservice    import java.sql.DriverManager    import groovy.sql.Sql    import io.vertx.core.AbstractVerticle    import io.vertx.core.Future    import io.vertx.core.Vertx    import io.vertx.core.http.HttpMethod

A class that can handle Vert.x events is called a Verticle. By extending the abstract class, AbstractVerticle, provided by the Vert.x framework, we can easily change our class into a Verticle. Take the following line:

    class Main {      ...    }

Change the preceding line to the following:

    class Main extends AbstractVerticle {      ...    }

The most important method of the AbstractVerticle abstract class is called ...

Get Introduction to JVM Languages now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.