MainController.java
@RequestMapping(value = "/dashboard/redirect", method = {RequestMethod.GET, RequestMethod.HEAD})
public String dashboardRedirect() {
User user = (User) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
if (user == null) return "redirect:/";
Set<UserRole> roles = user.getUserRoles();
for (UserRole role : roles) {
if (role.getListRole() == ListRole.ROLE_CLIENT) {
return "redirect:/dashboard/client/main";
} else if (role.getListRole() == ListRole.ROLE_EMPLOYEE) {
return "dashboardEmployeeMain"; //open page, its ok
} else if (role.getListRole() == ListRole.ROLE_ADMIN) {
return "redirect:/dashboard/admin/main";
}
}
return "access_denied";
}
DashboardEmployeeController.java have a problem "The origin server did not find a current representation for the target resource or is not willing to disclose that one exists." "PageNotFound:1120 - No mapping found for HTTP request with URI [/bank_war/dashboardEmployeeCredits] in DispatcherServlet with name 'mvc-dispatcher'"
class DashboardEmployeeController extends AbstractController {
private final static Logger logger = Logger.getLogger(DashboardEmployeeController.class);
private static String path = "/dashboard/employee/";
@Autowired
private CreditService creditService;
@RequestMapping(value = "/main", method = {RequestMethod.GET, RequestMethod.HEAD})
public String dashboardClientMain(Model model) {
logger.info("GET: " + path + "main");
User user = getCurrentUser();
if (user == null) return "redirect:/";
model.addAttribute("user", user);
return "dashboard_employee_main";
}
@RequestMapping(value = "/clients", method = {RequestMethod.GET, RequestMethod.HEAD})
public String dashboardEmployeeClients(Model model) {
logger.info("GET: " + path + "clients");
User user = getCurrentUser();
if (user == null) return "redirect:/";
model.addAttribute("user", user);
List<User> users = (List<User>)userService.getAllUnconfirmedUsers();
model.addAttribute("users", users);
return "dashboard_employee_clients";
}
@RequestMapping(value = "/credits", method = {RequestMethod.GET, RequestMethod.HEAD})
public String dashboardEmployeeCredits(Model model) {
logger.info("GET: " + path + "credits");
User user = getCurrentUser();
if (user == null) return "redirect:/";
model.addAttribute("user", user);
List<Credit> credits = (List<Credit>)creditService.getAllUnconfirmedCredits();
model.addAttribute("credits", credits);
return "dashboard_employee_credits";
}
Aucun commentaire:
Enregistrer un commentaire