1. Move query jsps into a separate directory
[proteocache.git] / server / compbio / controllers / MainController.java
index f918c24..4aeb1cd 100644 (file)
@@ -1,21 +1,15 @@
 package compbio.controllers;
 
-import java.security.Principal;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.ModelMap;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 
 @Controller
-public class MainController {
+public class MainController extends BasicController {
 
        @RequestMapping(value = "/index", method = RequestMethod.GET)
-       public String printPublicHome(ModelMap model, Principal principal) {
-               String name = "";
-               // if (null != name ) {
-               // name = principal.getName();
-               // }
-               model.addAttribute("username", name);
+       public String printPublicHome(ModelMap model) {
                model.addAttribute("message", "Spring Security Custom Form example");
                return "public";
        }
@@ -37,21 +31,14 @@ public class MainController {
        }
 
        @RequestMapping(value = "/denied", method = RequestMethod.GET)
-       public String denied(ModelMap model, Principal principal) {
-               String name = "unknown";
-               if (null != principal.getName())
-                       name = principal.getName();
-               model.put("username", name);
+       public String denied(ModelMap model) {
+               model.put("username", getPrincipalName());
                return "support/Denied";
        }
 
        @RequestMapping(value = "/home", method = RequestMethod.GET)
-       public String printHome(ModelMap model, Principal principal) {
-               String name = "unknown";
-               if (null != name) {
-                       name = principal.getName();
-               }
-               model.addAttribute("username", name);
+       public String printHome(ModelMap model ) {
+               model.addAttribute("username", getPrincipalName());
                model.addAttribute("message", "Spring Security Custom Form example");
                return "home";
        }