Example usage for org.springframework.web.bind.annotation RequestMethod POST

List of usage examples for org.springframework.web.bind.annotation RequestMethod POST

Introduction

In this page you can find the example usage for org.springframework.web.bind.annotation RequestMethod POST.

Prototype

RequestMethod POST

To view the source code for org.springframework.web.bind.annotation RequestMethod POST.

Click Source Link

Usage

From source file:com.practice.web.controller.LoginController.java

@RequestMapping(value = "/login", method = RequestMethod.POST)
public String postLoginPage(Model model, @ModelAttribute("login") Login login) {

    if (loginService.isValidUser(login)) {
        return "redirect:/member-area";
    } else {//from w  w  w  .j  ava  2s .  c  o m
        model.addAttribute("message", "Wrong Username or Password");
        return "login";
    }
}

From source file:controller.ChangepasswordController.java

@RequestMapping(value = "/process", method = RequestMethod.POST)
public String changepassProcess(Authentication authen, @RequestParam String newpass,
        @RequestParam String oldpass, ModelMap mm, HttpServletRequest req) {
    Customer cus = cusModel.find(authen.getName(), "username", false).get(0);
    if (!cus.getPassword().equals(oldpass)) {
        mm.put("check", true);
        mm.put("alert", "Old password invalid");
        mm.put("link", req.getContextPath() + "/customer/changepassword.html");
    } else {//from   w w w.  j  av a 2  s .c  om
        cus.setPassword(newpass);
        mm.put("check", cusModel.addOrUpdate(cus));
        mm.put("alert", "Password updated");
        mm.put("link", req.getContextPath());
    }
    return "changepassProcess";
}

From source file:com.cemeterylistingsweb.presentation.rest.LoginController.java

@RequestMapping(value = "create", method = RequestMethod.POST) // This the uri e.g http://localhost:8084/askweb/api/club/create
@ResponseBody //Converts output or response to JSON String
public String create(@RequestBody Subscriber sub) { // @RequestBody for converting incoming JSON call to Object
    cs.persist(sub);/*from   w  ww  .  j  a v a  2  s.co m*/
    System.out.println(" Create the Called ");
    return "Club created";
}

From source file:com.mycompany.springboot.controller.IndexRestController.java

@RequestMapping(value = "/", method = { RequestMethod.POST, RequestMethod.DELETE })
private List<Comment> post(@Validated @RequestBody Comment comment) {
    return commentService.saveComment(comment);
}

From source file:com.swcguild.springmvcwebapp.controller.Lucky7sController.java

@RequestMapping(value = "/lucky7s", method = RequestMethod.POST)
public String doPost(HttpServletRequest request, Model model) {

    String myAnswer = request.getParameter("myAnswer");

    //check if empty, then try catch around conversion to int
    try {/*from  w ww  .  j av  a2  s .  co  m*/

        int wallet = Integer.parseInt(request.getParameter("myAnswer"));

        do {

            int rInt = rGen.nextInt(11) + 2;

            if (wallet > maxMoney) {
                maxMoney = wallet;
            }
            if (maxMoney <= wallet) {
                timeToStop = rolls;
            }
            wallet = adjustWallet(rInt, wallet);
            rolls++;

        } while (wallet >= 1);

        DecimalFormat df = new DecimalFormat("#.00");

        model.addAttribute("rolls", rolls - 1);
        model.addAttribute("timeToStop", timeToStop);
        model.addAttribute("maxMoney", df.format(maxMoney));

    } catch (NumberFormatException e) {

    }

    return "lucky7sResponse";

}

From source file:com.usmanjamil.flightsite.controllers.UserController.java

@RequestMapping(value = "/user/sign-up", method = RequestMethod.POST, produces = "application/json", consumes = "application/json")
@ResponseBody//w  w  w.  j  a  va  2  s.c  om
public Response signUp(@RequestBody String input) {
    JSONObject obj = new JSONObject(input);

    String signUp = userService.signUp(obj.getString("email"), obj.getString("password"));

    return Response.ok(signUp).build();
}

From source file:sh.springboot.domain.BuahController.java

@RequestMapping(method = RequestMethod.POST)
public void save(@RequestBody Buah p) {
    buahDao.save(p);
}

From source file:bike.controller.TrainingPointController.java

@RequestMapping(value = "/trainingPoint/add", consumes = "application/json", method = RequestMethod.POST)
public String createTrainingPoint(@RequestBody TrainingPoint trainingPoint) {
    System.out.println("Downhill" + trainingPoint.getTraining().getDownhill());
    try {/*from   ww w .  j  a v a 2  s . co m*/

        trainingDao.save(trainingPoint.getTraining());
        trainingPointDao.save(trainingPoint);
        return "TrainingPoint added";
    } catch (Exception ex) {
        return "Error creating TrainingPoint";
    }

}

From source file:com.surfs.storage.web.controller.storage.UsersController.java

@RequestMapping(method = RequestMethod.POST, value = "/showUsers.do")
public ModelAndView showUsers(HttpSession session) {
    try {//from www.j  ava2  s  .co m
        List<Users> usersList = usersService.queryAllUsers(WebUtils.getCrrentDataCenterKey(session));
        return new ModelAndView("users", "usersList", usersList);
    } catch (Exception e) {
        return new ModelAndView("redirect:/login.jsp?error=" + e.getMessage());
    }
}

From source file:za.co.dwarfsun.jcmanager.presentation.rest.JobCardRestController.java

@RequestMapping(value = "create", method = RequestMethod.POST)
@ResponseBody/*  w  w w  .ja va2  s .  com*/
public String create(@RequestBody JobCard jobCard) {
    jobCardService.persist(jobCard);
    return "JobCard: " + jobCard.getName() + " created...";
}