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.FileController.java

/**
 * // www  .  ja  v a  2 s.c o  m
 */
@RequestMapping(value = "/upload", method = RequestMethod.POST, produces = "text/html; charset=UTF-8")
public void upload(FileType fileType, MultipartFile file, HttpServletResponse response) {
    Map<String, Object> data = new HashMap<String, Object>();
    if (!fileService.isValid(fileType, file)) {
        data.put("message", Message.warn("admin.upload.invalid"));
    } else {
        String url = fileService.upload(fileType, file, false);
        if (url == null) {
            data.put("message", Message.warn("admin.upload.error"));
        } else {
            data.put("message", SUCCESS_MESSAGE);
            data.put("url", url);
        }
    }
    try {
        response.setContentType("text/html; charset=UTF-8");
        JsonUtils.writeValue(response.getWriter(), data);
    } catch (IOException e) {
        e.printStackTrace();
    }
}

From source file:th.co.geniustree.dental.controller.TypeOfMedicalController.java

@RequestMapping(value = "/deletetypeofmedical", method = RequestMethod.POST)
private void deleteTypeOfMedical(@RequestBody TypeOfMedical typeOfMedical) {
    typeOfMedicalRepo.delete(typeOfMedical);
}

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

@RequestMapping(value = "/savestudentclassyear", method = RequestMethod.POST)
public void saveStudentClassYear(@Validated @RequestBody StudentClassYear studentClassYear) {
    studentClassYearrepo.save(studentClassYear);
}

From source file:com.leapfrog.springFramework.Controller.ProgrammeController.java

@RequestMapping(value = "/admin/insertprogramme", method = RequestMethod.POST)
public String insertProgramme(@RequestParam Map<String, String> parVal) {
    int faculty = Integer.parseInt(parVal.get("faculty"));
    String programme = parVal.get("programme");
    String type = parVal.get("type");
    String num = parVal.get("num");
    Programme prog = new Programme();
    faculties objfac = new faculties();
    objfac.setFacultyId(faculty);//from   w w  w. j  a  v  a2  s .c  o m

    prog.setProgrammeName(programme);
    prog.setProgrammeType(type);
    prog.setNum(Integer.parseInt(num));
    prog.setFaculty(objfac);
    Programme existProg = dao.CheckProgramme(programme);
    if (existProg != null) {
        return "redirect:" + "../admin/programme?q=exist";
    } else {
        dao.insert(prog);
    }
    return "redirect:" + "../admin/programme";
}

From source file:com.google.code.gerrytan.executorservice.HomeController.java

@RequestMapping(value = "/", method = RequestMethod.POST)
public String runTask(Model model) {
    int taskId = heavyTaskRunner.runTask();
    model.addAttribute("runTask", true);
    model.addAttribute("taskId", taskId);
    return "home";
}

From source file:com.dangdang.ddframe.job.console.controller.JobOperationController.java

@RequestMapping(value = "pause", method = RequestMethod.POST)
public void pauseJob(final ServerInfo jobServer) {
    jobAPIService.getJobOperatorAPI().pause(Optional.of(jobServer.getJobName()),
            Optional.of(jobServer.getIp()));
}

From source file:controller.MakeAgenda.java

@RequestMapping(method = RequestMethod.POST)
public String save(Model model, @ModelAttribute("appointment") @Valid Agenda agenda, BindingResult result) {
    if (result.hasErrors()) {
        return "makeAgenda";
    }/* w w  w  .  j  a va  2 s .c  om*/
    List<Appointment1> results = service.makeAgenda(agenda.getDoctor(), agenda.getDate());
    model.addAttribute("results", results);
    model.addAttribute("appointment", agenda);
    return "Agenda";
}

From source file:com.albert.swagger.SwaggerConTest.java

@ApiOperation(value = "", notes = "", response = Department.class, position = 1)
@RequestMapping(value = "/1.0/contact/add.do", method = RequestMethod.POST)
public void add(@RequestBody Department contact, HttpServletResponse response) {

    //  response.setHeader("Location",location);
}

From source file:com.artivisi.latihan.web.RoleController.java

@RequestMapping(value = "/role", method = RequestMethod.POST)
public void simpanRole(@RequestBody Role role) throws Exception {
    if (role == null) {
        throw new Exception("Role tidak boleh null");
    }//from   www.ja va  2  s  .  c  om

    roleService.save(role);
}

From source file:net.groupbuy.controller.admin.RoleController.java

/**
 * ?/* www .  j  av  a  2 s  .  c  o  m*/
 */
@RequestMapping(value = "/save", method = RequestMethod.POST)
public String save(Role role, RedirectAttributes redirectAttributes) {
    if (!isValid(role)) {
        return ERROR_VIEW;
    }
    role.setIsSystem(false);
    role.setAdmins(null);
    roleService.save(role);
    addFlashMessage(redirectAttributes, SUCCESS_MESSAGE);
    return "redirect:list.jhtml";
}