-
Notifications
You must be signed in to change notification settings - Fork 38.7k
Closed
Labels
in: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancementA general enhancement
Milestone
Description
Affects: 5.2
If WebMvc.fn is used with nested routes, it is not always necessary to specify the path pattern for every registered handler.
accept(APPLICATION_JSON).nest {
path("/{listId}").nest {
GET("", listHandler::findById)
PUT("", listHandler::update)
DELETE("", listHandler::delete)
}
path("/{listId}/{taskId}").nest {
GET("", taskHandler::findById)
DELETE("", taskHandler::delete)
}
}
The path pattern is only specified at the surrounding path
element. Below this element all handlers are related to the given path, like /{listId}/
.
A path
with verbs (GET
, PUT
, ...) would pretty much reflect the concept of a REST "resource".
I suggest the following syntax:
accept(APPLICATION_JSON).nest {
path("/{listId}").nest {
GET(listHandler::findById)
PUT(listHandler::update)
DELETE(listHandler::delete)
}
}
Since all handler registrations share the same base path, there is no need to specify it on each element.
It should be possible to use predicates without a path, too.
Metadata
Metadata
Assignees
Labels
in: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancementA general enhancement