adam bien's blog

Quarkus: Configuring Context and Resource Paths 📎

A Quarkus application exposes the JAX-RS resources directly from the "root":

The HelloResource:


@Path("/hello")
public class HelloResource {

    @GET
    @Produces(MediaType.TEXT_PLAIN)
    public String hello() {
        return "hello";
    }
}    

is available from: http://localhost:8080/hello

By adding the "servlet" extension with: mvn quarkus:add-extension -Dextension="servlet" the JAX-RS as well as the context path can be configured in src/main/resources/application.properties

The following configuration:


quarkus.servlet.context-path=/quark
quarkus.resteasy.path=/resources    

exposes the HelloResource as: http://localhost:8080/quark/resources/hello

See you at Web, MicroProfile and Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting. Is Munich's airport too far? Learn from home: airhacks.io.