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:net.groupbuy.controller.admin.ProductNotifyController.java

/**
 * ??/*w  ww  .  j  a  v  a 2s  .c o m*/
 */
@RequestMapping(value = "/send", method = RequestMethod.POST)
public @ResponseBody Message send(Long[] ids) {
    int count = productNotifyService.send(ids);
    return Message.success("admin.productNotify.sentSuccess", count);
}

From source file:edu.eci.cosw.controllers.ProductsController.java

@RequestMapping(value = "/jefe", method = RequestMethod.POST)
public ResponseEntity<?> adicionarFamilia(@RequestBody InscripcionJefes jefe) {
    services.addJefe(jefe);/*from  ww  w  .  j a v a  2  s .c o  m*/
    return new ResponseEntity<>(HttpStatus.ACCEPTED);
}

From source file:controller.UploadFileController.java

@RequestMapping(method = RequestMethod.POST)
public @ResponseBody String upload(@RequestParam(value = "file") MultipartFile mfile, HttpServletResponse res,
        HttpServletRequest req) {//from w  ww  . j  a v  a 2s . c  om
    long time = Calendar.getInstance().getTimeInMillis();
    String fileName = "";
    try {
        fileName = time + mfile.getOriginalFilename();
        File f = new File(req.getServletContext().getRealPath("/images") + "/" + fileName);
        if (!f.exists()) {
            f.createNewFile();
        }
        FileOutputStream out = new FileOutputStream(f);
        FileCopyUtils.copy(mfile.getBytes(), out);
    } catch (Exception ex) {
        ex.printStackTrace();
    }
    return "<img src='" + req.getContextPath() + "/images/" + fileName + "'/>";

}

From source file:edu.eci.arsw.msgbroker.PuntosController.java

@RequestMapping(method = RequestMethod.POST)
public ResponseEntity<?> manejadorPostRecursoXX(@RequestBody Point pt) {
    try {/*from ww w.  ja v  a2 s .co m*/
        msgt.convertAndSend("/topic/newpoint", pt);
        mp.adicionar(pt);
        if (mp.getSize() == 4) {
            msgt.convertAndSend("/topic/newpolygon", mp.Array());
            mp.reset();
        }
        return new ResponseEntity<>(HttpStatus.CREATED);
    } catch (Exception ex) {
        Logger.getLogger(STOMPMessagesHandler.class.getName()).log(Level.SEVERE, null, ex);
        return new ResponseEntity<>("Error bla bla bla", HttpStatus.FORBIDDEN);
    }

}

From source file:com.recursivechaos.clearent.controller.SaleController.java

@RequestMapping(value = "/sales", method = RequestMethod.POST)
public ResponseEntity<Void> postSale(@RequestBody Sale sale) {
    Sale newSale = saleService.createSale(sale);
    return new ResponseEntity<>(createHeaders(newSale), HttpStatus.CREATED);
}

From source file:com.hp.autonomy.frontend.find.core.configuration.ValidationController.java

@RequestMapping(value = "/config-validation", method = { RequestMethod.POST, RequestMethod.PUT })
@ResponseBody//from www  . j  a  v a 2  s . c  o m
public ValidationResults validConfig(@RequestBody final C config) {
    return validationService.validateConfig(config);
}

From source file:de.document.controller.ProzedurController.java

@RequestMapping(value = "/save", method = { RequestMethod.POST })
public Document saveDoc(@RequestBody Prozedur request) {
    return service.save(request);

}

From source file:com.aalto.controllers.ProjectController.java

@RequestMapping(value = "/newProject", method = RequestMethod.POST)
public Project createProject(@RequestParam Map<String, String> reqParams) {
    logger.log(Level.INFO, "log: ProjectController newProject!!");
    logger.log(Level.INFO, reqParams.toString());
    String name = reqParams.get("name");

    Project newProject = new Project(name);

    Long pid = this.projectRepo.save(newProject);
    Project savedProject = this.projectRepo.find(pid);

    return savedProject;
}

From source file:com.sjsu.bikelet.web.TenantLicensePolicyController.java

@RequestMapping(method = RequestMethod.POST, produces = "text/html")
public String create(@Valid TenantLicensePolicy tenantLicensePolicy, BindingResult bindingResult, Model uiModel,
        HttpServletRequest httpServletRequest) {
    validateDate(bindingResult, tenantLicensePolicy);

    if (bindingResult.hasErrors()) {
        populateEditForm(uiModel, tenantLicensePolicy);
        return "tenantlicensepolicys/create";
    }//from  ww w .j  a v a2  s . c o  m
    uiModel.asMap().clear();

    try {
        tenantLicensePolicyService.saveTenantLicensePolicy(tenantLicensePolicy);
    } catch (BikeletValidationException e) {
        bindingResult.addError(new ObjectError("tenantLicensePolicy", e.getMessage()));
        if (bindingResult.hasErrors()) {
            populateEditForm(uiModel, tenantLicensePolicy);
            return "tenantlicensepolicys/create";
        }
    }

    return "redirect:/tenantlicensepolicys/"
            + encodeUrlPathSegment(tenantLicensePolicy.getId().toString(), httpServletRequest);
}

From source file:info.michaelchurch.arule.controllers.ContactController.java

@RequestMapping(method = RequestMethod.POST)
public String Process(Model model, @Valid Comment comment, BindingResult result) {

    if (result.hasErrors()) {
        return "contact";
    }//  w w  w .j av a 2 s. c om

    if (contactProcessor.process(comment)) {
        model.addAttribute("verdict", "Success");
    } else {
        model.addAttribute("verdict", "Failure");
    }
    return "contact";
}