Consider we have small web application with following routes:
“/” – return main page
“/post/add/” – return new post page
we write two following controllers to handle this routes:
@Path("/")
public class HomeController {
@GET
@Produces(HTML)
public String home() {
return render(new Page(HOME_PAGE_TEMPLATE));
}
}
and
@Path("/post")
public class PostController {
@GET
@Path("/add")
@Produces(HTML)
public String add() {
return render(new Page(ADD_USER_PAGE_TEMPLATE));
}
}
the problem is “HomeController” now handle all requests. How to force it to handle only “/” route?
UPD:
The solution is use @Path(“”) annotation.
The solution is use @Path(“”) annotation