package compbio.controllers;
-import java.security.Principal;
import java.util.List;
import java.util.Map;
* @author Natasha Sherstneva
*/
@Controller
-public class IPDataController {
+public class IPDataController extends BasicController {
@RequestMapping(value = "/admin/ip/counts/query", method = RequestMethod.GET)
- public String initStatisticsForm(Map<String, Object> model, Principal principal) {
- model.put("username", principal.getName());
+ public String initStatisticsForm(Map<String, Object> model) {
+ model.put("username", "name:" + getPrincipalName());
model.put("value", 5);
- return "queryIPStatistics";
+ return "query/IPStatistics";
}
@RequestMapping(value = "/admin/ip/query", method = RequestMethod.GET)
- public String initOneIPForm(Map<String, Object> model, Principal principal) {
- model.put("username", principal.getName());
+ public String initOneIPForm(Map<String, Object> model) {
+ model.put("username", getPrincipalName());
model.put("value", "127.0.0.1");
- return "queryIP";
+ return "query/IP";
}
@RequestMapping(value = "/admin/ip/counts/results", method = RequestMethod.GET)
- public String findIPwithCounter(@RequestParam("JobCounter") String counter, Map<String, Object> model, Principal principal) {
- model.put("username", principal.getName());
+ public String findIPwithCounter(@RequestParam("JobCounter") String counter, Map<String, Object> model) {
+ model.put("username", getPrincipalName());
if (counter.equals("")) {
model.put("error", "The value must not be empty");
model.put("value", counter);
- return "queryIPStatistics";
+ return "query/IPStatistics";
}
int realcounter;
} catch (NumberFormatException e) {
model.put("error", "The value must be an integer number");
model.put("value", counter);
- return "queryIPStatistics";
+ return "query/IPStatistics";
}
if (realcounter < 1) {
model.put("error", "The value must be greater than 0");
model.put("value", counter);
- return "queryIPStatistics";
+ return "query/IPStatistics";
}
final long startTime = System.currentTimeMillis();
}
@RequestMapping(value = "/admin/ip/results", method = RequestMethod.GET)
- public String findIP(@RequestParam("ip") String ip, Map<String, Object> model, Principal principal) {
- model.put("username", principal.getName());
+ public String findIP(@RequestParam("ip") String ip, Map<String, Object> model) {
+ model.put("username", getPrincipalName());
final long startTime = System.currentTimeMillis();
CassandraRequester cr = new CassandraRequester();
UserBean r = cr.readIp(ip);