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:io.curly.advisor.integration.service.NotificationClient.java

@RequestMapping(value = "/notifications", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
ResponseEntity<Void> sendEvent(@RequestBody Review review);

From source file:cs544.letmegiveexam.controller.AdminController.java

@RequestMapping(value = "/addSubject", method = RequestMethod.POST)
public String addSubject(@Valid Subject subject, BindingResult result) {
    if (result.hasErrors()) {
        return "addSubject";
    } else {//from   w  ww .  jav a2s . c  o m
        subjectService.addSubject(subject);
        return "redirect:/questionSetting";
    }
}

From source file:th.co.geniustree.intenship.advisor.controller.AppointmentController.java

@RequestMapping(value = "/saveappointment", method = RequestMethod.POST)
public void saveAppointment(@Validated @RequestBody Appointment appointment) {
    appointmentRepo.save(appointment);//from   ww  w.j  av  a  2  s  .c o m
}

From source file:com.tsg.contactlistmvc.SearchController.java

@RequestMapping(value = "search/contacts", method = RequestMethod.POST)
@ResponseBody/*  w w w . j ava  2 s .  c o  m*/
public List<Contact> searchContacts(@RequestBody Map<String, String> searchMap) {
    Map<SearchTerm, String> criteriaMap = new HashMap<>();
    String currentTerm = searchMap.get("firstName");
    if (!currentTerm.isEmpty()) {
        criteriaMap.put(SearchTerm.FIRSTNAME, currentTerm);
    }
    currentTerm = searchMap.get("lastName");
    if (!currentTerm.isEmpty()) {
        criteriaMap.put(SearchTerm.LASTNAME, currentTerm);
    }
    currentTerm = searchMap.get("company");
    if (!currentTerm.isEmpty()) {
        criteriaMap.put(SearchTerm.COMPANY, currentTerm);
    }
    currentTerm = searchMap.get("email");
    if (!currentTerm.isEmpty()) {
        criteriaMap.put(SearchTerm.EMAIL, currentTerm);
    }
    currentTerm = searchMap.get("phone");
    if (!currentTerm.isEmpty()) {
        criteriaMap.put(SearchTerm.PHONE, currentTerm);
    }
    return dao.searchContacts(criteriaMap);
}

From source file:ch.heigvd.gamification.api.EventsEndpoint.java

@Override
@RequestMapping(method = RequestMethod.POST)
public ResponseEntity reportEvent(
        @ApiParam(value = "token that identifies the app sending the request", required = true) @RequestHeader(value = "X-Gamification-Token", required = true) String xGamificationToken,
        @ApiParam(value = "The event that occured in the realm of the gamified application", required = true) @RequestBody EventDTO event) {

    try {//from w  w  w. ja  v  a2s  . c  o m
        eventProcessor.processEvent(xGamificationToken, event);
    } catch (DataIntegrityViolationException e) {

        eventProcessor.processEvent(xGamificationToken, event);
    }

    return ResponseEntity.ok().build();
}

From source file:com.onclave.testbench.jdbcTemplate.DAOSupport.StudentJDBCController.java

@RequestMapping(value = "/jdbc/addNewStudent", method = RequestMethod.POST)
public String addNewStudent(@ModelAttribute("jdbcStudentForm") StudentPOJO student, BindingResult result,
        Model model) {//ww w .j  a  v a 2 s. c om
    boolean dbResult = studentDAOImplementation.createNewStudent(student);
    model.addAttribute("result", dbResult);
    model.addAttribute("jdbcStudentForm", student);

    return "/jdbc/index";
}

From source file:samples.Server.java

@RequestMapping(value = "/sentiment", method = RequestMethod.POST, produces = { "application/json" })
public String getSentiment(@RequestBody String input) throws Exception {
    try {//w  ww .  j av  a  2  s .c o  m
        JSONObject jsonInput = new JSONObject(input);
        return analyzer.getSentiment(jsonInput.getString("input")).toString();
    } catch (Exception e) {
        throw e;
    }
}

From source file:io.pivotal.ecosystem.service.HelloController.java

@RequestMapping(value = "/users", method = RequestMethod.POST)
ResponseEntity<User> createUser(@RequestBody User user) {
    if (userStore.userExists(user.getName())) {
        return new ResponseEntity<>(HttpStatus.CONFLICT);
    }/*from   w w  w .j  av a2  s  .  co  m*/
    setPassword(user);
    userStore.save(user);
    return new ResponseEntity<>(user, HttpStatus.CREATED);
}

From source file:com.teamexception.reseravationmaven.controller.EquipmentController.java

@RequestMapping(value = "addEquipment", method = RequestMethod.POST)
public String addEquipment(HttpServletRequest request)
        throws ClassNotFoundException, SQLException, ServletException, IOException {
    String oldId = equipmentdao.getLastId();
    String newId = IdGenarator.idGenarator("E", oldId);

    settingUpValues(request, newId);//from w w w . j  a  v a2  s  .  co m
    /*= new Equipment(IdGenarator.idGenarator("E", oldId),"FOOOOOOOOO1" ,request.getParameter("equipmentName"), request.getParameter("description"), request.getParameter("manufacturer"), Integer.parseInt(request.getParameter("qty")), request.getParameter("purchasedDate"));*/
    if (equipmentdao.addEquipment(equipment)) {
        String msg = "Added Sucessfully";
        request.setAttribute("msg", msg);
    } else {
        String msg = "Failed To add";
        request.setAttribute("msg", msg);
    }
    return "success";
}

From source file:com.traveltainment.itea.bernat.contactwebapp.mvccontroller.ContactController.java

@RequestMapping(method = RequestMethod.POST)
public String submit(final Contact contact) {
    contactRepo.save(contact);
    return "redirect:/";
}