Module io.inverno.mod.web.server
Annotation Interface WebController
The WebController annotation is used in conjunction with the @Bean
annotation to indicate a Web controller bean.
Web controller beans are used to specify Web routes exposed in a module. These routes are aggregated in a bean, generated by the Web compiler, which configures the Web server on application startup.
Web routes are declared as methods annotated with @Webroute
. A Web controller defines a base path, set to '/' by default, for all routes defined in the controller.
For instance, in the following example a request to /book
is handled by the getList()
method and a request to /book/1
by the get()
method.
@WebController( path = "/book" )
@Bean
public class BookResource {
@WebRoute
public List<Book> getList() {
...
}
@WebRoute( path = "/{id}" )
public Book get(@PathParam String id) {
...
}
}
- Since:
- 1.0
- Author:
- Jeremy Kuhn
- See Also:
-
Optional Element Summary
-
Element Details
-
path
String pathThe base path of all routes defined in the Web controller.
- Returns:
- the base path
- Default:
"/"
-