docs
reference
tessl install tessl/maven-io-quarkus--quarkus-rest@3.15.0A Jakarta REST implementation utilizing build time processing and Vert.x for high-performance REST endpoints with reactive programming support, security integration, and cloud-native features.
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");
}
}import jakarta.annotation.security.RolesAllowed;
@Path("/admin")
@RolesAllowed("admin")
public class AdminResource {
@GET
public List<User> getUsers() {
return userService.findAll();
}
}@Blocking or @NonBlocking annotations| Feature | Description | Reference |
|---|---|---|
| Jakarta REST | Standard JAX-RS annotations (@GET, @POST, @Path, etc.) | jakarta-rest.md |
| Reactive | Mutiny Uni/Multi for async operations | reactive-programming.md |
| Security | RBAC, permissions, authentication | security.md |
| Filters | Request/response filtering, exception mapping | filters.md |
| REST Response | Type-safe response wrapper | rest-response.md |
| REST Client | Declarative REST clients | rest-client.md |
| Streaming | SSE and reactive streams | streaming.md |
| Multipart | File uploads and multipart forms | multipart-forms.md |
| Caching | HTTP caching directives | caching.md |
| Configuration | Runtime configuration options | configuration.md |
@GET @POST @PUT @DELETE @PATCH @HEAD @OPTIONS@PathParam("id") // URL path parameter
@QueryParam("filter") // Query string parameter
@HeaderParam("auth") // HTTP header
@FormParam("data") // Form field
@Context // Inject context objects@RestPath("id") // Shorter @PathParam
@RestQuery("filter") // Shorter @QueryParam
@RestHeader("auth") // Shorter @HeaderParam@RolesAllowed("admin") // Role-based access
@PermissionsAllowed("doc:read") // Permission-based access
@Authenticated // Require authentication
@PermitAll // Allow all users@ServerRequestFilter // Request filter method
@ServerResponseFilter // Response filter method
@ServerExceptionMapper // Exception to Response mapping| 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 |
CompletionStage<T> | Non-blocking (I/O thread) | Java async API |
Response | Depends on content | Full HTTP control |
RestResponse<T> | Depends on content | Type-safe HTTP control |
// Simple return
return "text";
return new User("Alice");
// RestResponse
return RestResponse.ok(user);
return RestResponse.notFound();
return RestResponse.status(201, created);
// Response builder
return Response.ok(entity)
.header("X-Custom", "value")
.build();@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);
// Combine
return Uni.combine().all()
.unis(uni1, uni2, uni3)
.asTuple();Step-by-step instructions for common tasks:
Real-world usage scenarios:
Detailed API documentation:
Core APIs:
Features:
Configuration & Integration:
Advanced:
Quarkus processes REST endpoints at build time, generating optimized bytecode for faster startup and lower memory usage.
Seamless integration with Mutiny for non-blocking, reactive programming. Methods returning Uni or Multi automatically run on I/O threads.
Built-in support for role-based and permission-based access control with automatic security context management.
Simplified filter annotations (@ServerRequestFilter, @ServerResponseFilter) with automatic parameter injection and reactive support.
RestResponse<T> provides type-safe response handling with full control over status, headers, and entity.
Create REST clients using interfaces with JAX-RS annotations. Supports reactive types, custom headers, and error handling.
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.
Quarkus REST integrates with:
@NonBlocking for fast, non-blocking operations