docs
reference
tessl install tessl/maven-io-quarkus--quarkus-resteasy-reactive@3.15.0A Jakarta REST implementation utilizing build time processing and Vert.x for high-performance REST endpoints with reactive capabilities in cloud-native environments.
Quarkus REST is a modern Jakarta REST (JAX-RS) implementation built on Vert.x for high-performance, reactive REST endpoints with build-time optimization.
Maven:
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-rest</artifactId>
</dependency>Gradle:
implementation("io.quarkus:quarkus-rest")import jakarta.ws.rs.*;
import jakarta.ws.rs.core.MediaType;
@Path("/hello")
public class HelloResource {
@GET
@Produces(MediaType.TEXT_PLAIN)
public String hello() {
return "Hello, World!";
}
}import io.smallrye.mutiny.Uni;
@Path("/async")
public class AsyncResource {
@GET
public Uni<String> getData() {
return Uni.createFrom().item("Async response");
}
}@Blocking or @NonBlocking annotations| Return Type | Execution | Use Case |
|---|---|---|
T | Blocking (worker thread) | Simple synchronous operations |
Uni<T> | Non-blocking (I/O thread) | Single async value |
Multi<T> | Non-blocking (I/O thread) | Stream of values |
RestResponse<T> | Depends on content | Type-safe HTTP control |
@GET @POST @PUT @DELETE @PATCH @HEAD @OPTIONS@RestPath("id") // URL path parameter
@RestQuery("filter") // Query string parameter
@RestHeader("auth") // HTTP header
@RestForm("data") // Form field@RolesAllowed("admin") // Role-based access
@PermissionsAllowed("doc:read") // Permission-based access
@Authenticated // Require authentication@ServerRequestFilter // Request filter method
@ServerResponseFilter // Response filter method
@ServerExceptionMapper // Exception to Response mapping// Simple return
return "text";
return new User("Alice");
// RestResponse
return RestResponse.ok(user);
return RestResponse.notFound();
return RestResponse.status(201, created);@ServerExceptionMapper
public Response handleError(MyException ex) {
return Response.status(400)
.entity(ex.getMessage())
.build();
}// Transform
return repository.findById(id)
.onItem().transform(entity -> new DTO(entity));
// Error recovery
return service.getData()
.onFailure().recoverWithItem(defaultValue);
// Retry
return client.call()
.onFailure().retry().atMost(3);Common configuration properties:
# Base path for REST endpoints
quarkus.rest.path=/api
# Multipart configuration
quarkus.rest.multipart.input-part.default-charset=UTF-8
# Buffer sizes
quarkus.rest.input-buffer-size=10240
quarkus.rest.output-buffer-size=8191See Configuration Reference for complete options.
Step-by-step instructions for common tasks:
Real-world usage scenarios:
Detailed API documentation:
Core APIs:
Features:
Integration:
Configuration:
Advanced:
RestResponse<T> for compile-time type checking@NonBlocking for fast, non-blocking operations