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.nebhale.demo.web.LoggingController.java

@RequestMapping(method = RequestMethod.POST, value = "")
String log(@RequestBody String message) {
    this.logger.info("[LOGGING-CONTROLLER] {}", message);
    return "Logged";
}

From source file:com.cemeterylistingsweb.presentation.rest.UnpublishedDeceasedListingsController.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 RequiresApprovalDeceasedListing PDL) { // @RequestBody for converting incoming JSON call to Object
    adls.persist(PDL);/*from w  ww.  ja  v a 2 s.  co  m*/
    System.out.println(" Create the Called ");
    return "createUnpublishedListing";
}

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

@RequestMapping(value = "create", method = RequestMethod.POST)
@ResponseBody/*  ww w.  ja  v  a2  s  .  c om*/
public String create(@RequestBody ContactPerson contactPerson) {
    contactPersonService.persist(contactPerson);
    return "ContactPerson: " + contactPerson.getDescription() + " created...";
}

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

@RequestMapping(value = "create", method = RequestMethod.POST)
@ResponseBody/*from   w  w w .j  av  a  2  s .  co m*/
public String create(@RequestBody JobAttachment jobAttachment) {
    jobAttachmentService.persist(jobAttachment);
    return "JobAttachment: " + jobAttachment.getFilePath() + " created...";
}

From source file:edu.liberty.sample.person.PersonController.java

@RequestMapping(value = "", method = RequestMethod.POST)
public Response insertPerson(@RequestBody Person person) {
    personRepository.save(person);//from   w  ww . j a v  a2  s .co m
    return new Response(person);
}

From source file:test.phoenixnap.oss.plugin.naming.testclasses.ResponseBodyTestControllerError.java

@RequestMapping(value = "/base/endpointWithResponseType", method = { RequestMethod.POST }, produces = {
        "application/test+json" })
public @ResponseBody TwoElementClass endpointWithResponseType() {
    return null;// w  w w . ja v a 2  s  .  c  om
}

From source file:com.matrimony.controller.RecoverController.java

@RequestMapping(value = "recover", method = RequestMethod.POST)
public String doStringRecover(HttpServletRequest request, String textField, String process,
        @ModelAttribute("recoverUser") User ruser, BindingResult bindingResult) {
    if ("level1".equals(process)) {
        System.out.println("process " + process);
        User userRecover = UserDAO.findByEmail(textField);
        if (userRecover == null) {
            request.setAttribute("recoverRespCode", 0);
        } else {//from w w w . j  a  va 2  s  .  c  o m
            request.setAttribute("recoverRespCode", 1);
            String code = recoverUser(userRecover);
            request.getSession().setAttribute("userRecover", userRecover);
            request.getSession().setAttribute("codeRecover", code);
        }
    } else if ("level2".equals(process) && null != request.getSession().getAttribute("codeRecover")) {
        System.out.println("process " + process);
        String c = (String) request.getSession().getAttribute("codeRecover");
        if (c.equals(textField)) {
            request.getSession().setAttribute("codeRecover", null);
            request.getSession().setAttribute("recoverSuccess", true);
            request.setAttribute("recoverRespCode", 4);
        } else {
            request.setAttribute("recoverRespCode", 3);
        }
    } else if ("level3".equals(process) && null != request.getSession().getAttribute("recoverSuccess")) {
        if (bindingResult.hasFieldErrors("username") && bindingResult.hasFieldErrors("password")) {
            request.setAttribute("recoverRespCode", 4);
            return "recoverUser";
        } else {
            User userRecover = (User) request.getSession().getAttribute("userRecover");
            userRecover.setSalt(HashUtil.generateSalt(UUID.randomUUID().toString()));
            userRecover.setPassword(HashUtil.hashPassword(ruser.getPassword(), userRecover.getSalt()));
            UserDAO.Update(userRecover);
            return "redirect:";
        }
    }
    return "recoverUser";
}

From source file:com.tsg.cms.TagController.java

@RequestMapping(value = "/tag/{postId}", method = RequestMethod.POST)
@ResponseStatus(HttpStatus.CREATED)/*ww w .j a  v a  2 s.c o m*/
@ResponseBody
public TagContainer createTag(@PathVariable("postId") int postId, @Valid @RequestBody String tagName) {
    TagContainer tagContainer = new TagContainer();

    String[] tagArray = tagName.split(",");

    for (String s : tagArray) {
        tagContainer.setTagName(tagDao.addTag(s, postId));

    }

    return tagContainer;

}

From source file:test.phoenixnap.oss.plugin.naming.testclasses.ParamTestControllerDowngradeToWarning.java

@RequestMapping(value = "/base/endpointWithURIParam/{uriParam}", method = { RequestMethod.POST })
public String endpointWithURIParamPost() {
    return null;
}

From source file:com.mycompany.testeproject.AusenciaController.java

@RequestMapping(path = "/addAus", method = RequestMethod.POST)
public Tausencia addAus(@RequestBody Ausencia aus) {
    log.info("AusenciasController - A criar Ausencia " + aus.getIdAusencia());
    Tausencia saveAusencia = dao.addAus(aus);

    return saveAusencia;
}