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

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

Introduction

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

Prototype

RequestMethod PUT

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

Click Source Link

Usage

From source file:runtheshow.resource.webservice.EventService.java

@RequestMapping(value = "/update", method = RequestMethod.PUT, consumes = "application/json; charset=UTF-8")
public Boolean updateUser(@RequestBody Evenement event, HttpServletResponse response) {
    return metier.updateEvenement(event);
}

From source file:cz.sohlich.workstack.api.TaskResource.java

@RequestMapping(method = RequestMethod.PUT)
public TaskDTO createOrUpdate(@RequestBody TaskDTO task) {
    task.setUser(getCurrentUser());
    return taskService.createOrUpdateTask(task);
}

From source file:net.prasenjit.auth.controller.MeController.java

/**
 * <p>changePassword.</p>// ww w . j a  v a  2 s .  c o  m
 *
 * @param request a {@link net.prasenjit.auth.model.ChangePasswordRequest} object.
 */
@RequestMapping(value = "/api/me", method = RequestMethod.PUT, params = "operation=changePassword")
@ResponseStatus(HttpStatus.ACCEPTED)
public void changePassword(@Validated @RequestBody ChangePasswordRequest request) {
    boolean status = userService.changePassword(request.getCurrentPassword(), request.getNewPassword());
    if (!status) {
        throw new RuntimeException("Failed to change password");
    }
}

From source file:com.aplikasi.penjualan.controller.DataBarangController.java

@RequestMapping(value = "/barang/{kode}", method = RequestMethod.PUT)
@ResponseStatus(HttpStatus.OK)/*  w ww  .  j a  v  a2 s  .c  o  m*/
public void updateDataBarang(@PathVariable("kode") String kode, @RequestBody @Valid DataBarang k) {
    k.setKode(kode);
    kd.save(k);
}

From source file:id.qwack.controller.TagController.java

@RequestMapping(method = RequestMethod.PUT)
public String update(@RequestBody Tag t) {
    TagService tag = new TagService();
    tag.update(t);//from  w  ww  .  j  a  v a 2  s  .  c o m

    return "Tag ID " + t.getId() + " updated";
}

From source file:com.github.leonardoxh.temporeal.controller.NoticeController.java

@RequestMapping(value = "/notice/new", method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public Notice newNotice(@RequestBody(required = true) Notice notice) {
    NoticeDao.saveOrUpdate(notice);/*w  w  w .  j  a v  a 2  s .  c  om*/
    PushSender.send(PushSender.Entity.NOTICE);
    return notice;
}

From source file:com.example.posting.BlogController.java

@RequestMapping(value = "/post", method = RequestMethod.PUT, consumes = "application/json")
public @ResponseBody BlogPost updatePost(@RequestParam(value = "id", required = true) long id,
        @RequestBody BlogPost post) {//w w w . j a va  2  s . c o  m
    return postService.updatePost(id, post, (User) authentication.getPrincipal());
}

From source file:com.swcguild.vendingmachinemvc.controller.UserController.java

@RequestMapping(value = "/item/{id}", method = RequestMethod.PUT)
@ResponseStatus(HttpStatus.NO_CONTENT)/*  w w w .j  av  a2s.c  o  m*/
public void putItem(@PathVariable("id") int id, @RequestBody Item item) {
    item.setItemId(id);
    dao.updateItem(item);

}

From source file:net.triptech.buildulator.web.AdminController.java

@RequestMapping(method = RequestMethod.PUT)
@PreAuthorize("hasRole('ROLE_ADMIN')")
public String update(@Valid Preferences preferences, BindingResult bindingResult, Model uiModel,
        HttpServletRequest request) {/*from   w w  w. j a va2  s .  c  om*/

    if (bindingResult.hasErrors()) {
        uiModel.addAttribute("preferences", preferences);

        FlashScope.appendMessage(getMessage("buildulator_object_validation", Preferences.class), request);

        return "admin/update";
    }

    uiModel.asMap().clear();
    if (preferences.getId() != null) {
        // Updating existing preferences
        preferences.merge();
    } else {
        // No preferences exist yet
        preferences.persist();
        preferences.flush();
    }
    request.getSession().getServletContext().setAttribute("Preferences", preferences);

    FlashScope.appendMessage(getMessage("preferences_edited"), request);

    return "redirect:/admin";
}

From source file:com.github.lynxdb.server.api.http.handlers.EpTree.java

@RequestMapping(path = "/", method = { RequestMethod.GET, RequestMethod.POST, RequestMethod.DELETE,
        RequestMethod.PUT }, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity root() {
    return ResponseEntity.status(HttpStatus.NOT_IMPLEMENTED).build();
}