Add the "Reload" and "CSV" buttons
[proteocache.git] / server / compbio / controllers / MainController.java
1 package compbio.controllers;
2
3 import org.springframework.stereotype.Controller;
4 import org.springframework.ui.ModelMap;
5 import org.springframework.web.bind.annotation.RequestMapping;
6 import org.springframework.web.bind.annotation.RequestMethod;
7
8 @Controller
9 public class MainController extends BasicController {
10
11         @RequestMapping(value = "/index", method = RequestMethod.GET)
12         public String printPublicHome(ModelMap model) {
13                 model.addAttribute("username", getPrincipalName());
14                 if (isUserRole())
15                         return "home";
16                 return "public";
17         }
18
19         @RequestMapping(value = "/login", method = RequestMethod.GET)
20         public String login(ModelMap model) {
21                 return "login";
22         }
23
24         @RequestMapping(value = "/loginfailed", method = RequestMethod.GET)
25         public String loginerror(ModelMap model) {
26                 model.addAttribute("error", "Wrong user name or password");
27                 return "login";
28         }
29
30         @RequestMapping(value = "/logout", method = RequestMethod.GET)
31         public String logout(ModelMap model) {
32                 return "public";
33         }
34
35         @RequestMapping(value = "/denied", method = RequestMethod.GET)
36         public String denied(ModelMap model) {
37                 model.put("username", getPrincipalName());
38                 return "support/Denied";
39         }
40
41         @RequestMapping(value = "/home", method = RequestMethod.GET)
42         public String printHome(ModelMap model) {
43                 model.addAttribute("username", getPrincipalName());
44                 return "home";
45         }
46
47 }