O'Reilly logo

Introduction to JVM Languages by Vincent van der Leun

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required