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:ui.controller.ItemDatabaseRestController.java

@RequestMapping(method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_VALUE)
public void updateTweet(@RequestBody User u) {
    getService().updateUser(u);
}

From source file:net.eusashead.hateoas.conditional.interceptor.AsyncTestController.java

@RequestMapping(method = RequestMethod.PUT)
public Callable<ResponseEntity<Void>> put() {
    return new Callable<ResponseEntity<Void>>() {

        @Override/*from w w  w.j  a  v  a  2s  . c  om*/
        public ResponseEntity<Void> call() throws Exception {
            HttpHeaders headers = new HttpHeaders();
            headers.setETag("\"123456\"");
            return new ResponseEntity<Void>(headers, HttpStatus.NO_CONTENT);
        }
    };
}

From source file:com.expedia.seiso.web.controller.v1.ServiceInstancePortControllerV1.java

@RequestMapping(value = SINGLE_URI_TEMPLATE, method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_VALUE)
@ResponseStatus(HttpStatus.NO_CONTENT)/*from   www  .  ja  va2  s. c  o  m*/
public void put(@PathVariable String serviceInstanceKey, @PathVariable Integer number, PEResource sipResource) {
    basicItemDelegate.put(sipResource.getItem(), true);
}

From source file:com.baidu.terminator.manager.action.LinkControlAction.java

@RequestMapping(value = "/stop/{linkId}", method = RequestMethod.PUT)
@ResponseStatus(HttpStatus.NO_CONTENT)//  w  w  w  .ja  v  a 2 s  . com
public void stopServer(@PathVariable Integer linkId) {
    linkControlService.stopServer(linkId);
}

From source file:com.artivisi.salary.payroll.system.controller.PinjamanController.java

@RequestMapping(value = "/pinjaman/{id}", method = RequestMethod.PUT)
public void editPinjaman(@PathVariable String id, @RequestBody Pinjaman p) throws Exception {
    Pinjaman pinjaman = pinjamanService.findOne(id);
    if (pinjaman == null) {
        throw new Exception("User tidak ditemukan");
    }/*from  ww w .  j  a  v  a  2 s . c  o m*/

    p.setId(pinjaman.getId());
    pinjamanService.save(p);
}

From source file:com.artivisi.salary.payroll.system.controller.PotonganController.java

@RequestMapping(value = "/potongan/{id}", method = RequestMethod.PUT)
public void editPotongan(@PathVariable String id, @RequestBody Potongan p) throws Exception {
    Potongan potongan = potonganService.findOne(id);
    if (potongan == null) {
        throw new Exception("User tidak ditemukan");
    }//from  www.  j  a  v a2  s .c  o  m

    p.setId(potongan.getId());
    potonganService.save(p);
}

From source file:org.smartparam.manager.spring.RepositoryEditController.java

@RequestMapping(value = "{in}/parameters", method = RequestMethod.PUT)
@ResponseBody/*w w w.j  av  a 2 s. c om*/
public void create(@PathVariable("in") String in, @RequestBody SimpleParameter parameter) {
    paramEditor.createParameter(new RepositoryName(in), parameter);
}

From source file:edu.sjsu.cmpe275.lab2.service.ManageFriendshipController.java

/** Add a friendship object
 (9) Add a friend/*from   w  w w  .j  a v a 2  s.c o  m*/
 Path:friends/{id1}/{id2}
 Method: PUT
        
 This makes the two persons with the given IDs friends with each other.
 If either person does not exist, return 404.
 If the two persons are already friends, do nothing, just return 200. Otherwise,
 Record this friendship relation. If all is successful, return HTTP code 200 and any
 informative text message in the HTTP payload.
        
 * @param a         Description of a
 * @param b         Description of b
 * @return         Description of c
 */

@RequestMapping(value = "/{id1}/{id2}", method = RequestMethod.PUT)
public ResponseEntity createFriendship(@PathVariable("id1") long id1, @PathVariable("id2") long id2) {
    Session session = null;
    Transaction transaction = null;
    Person person1 = null, person2 = null;

    try {
        session = sessionFactory.openSession();
        transaction = session.beginTransaction();
        person1 = (Person) session.get(Person.class, id1);
        person2 = (Person) session.get(Person.class, id2);
        if (person1 == null || person2 == null) {
            throw new HibernateException("Can't find persons with id1 = " + id1 + " and id2 = " + id2);
        }
        List<Person> f = person1.getFriends();
        if (!f.contains(person2)) {
            f.add(person2);
        }
        person1.setFriends(f);
        session.update(person1);

        f = person2.getFriends();
        if (!f.contains(person1)) {
            f.add(person1);
        }
        person2.setFriends(f);
        session.update(person2);

        transaction.commit();
    } catch (HibernateException e) {
        if (transaction != null) {
            transaction.rollback();
        }
        return new ResponseEntity("Can't find persons with id1 = " + id1 + " and id2 = " + id2,
                HttpStatus.NOT_FOUND);
    } finally {
        if (session != null) {
            session.close();
        }
    }

    return new ResponseEntity("Created the friendship between id1 = " + id1 + " and id2 = " + id2,
            HttpStatus.OK);
}

From source file:aka.pirana.springsecurity.web.controllers.UserResource.java

@RequestMapping(value = "", method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody/*from  ww  w. j av a  2  s . c om*/
public ResponseEntity<User> updateUser(@RequestBody User user) {
    System.out.println("aka.pirana.springsecurity.web.controllers.UserResource.updateUser()");
    User savedUser = userService.update(user);
    return new ResponseEntity<User>(savedUser, HttpStatus.OK);
}

From source file:am.ik.categolj2.api.logger.LoggerRestController.java

@RequestMapping(value = "{name}", method = RequestMethod.PUT, headers = Categolj2Headers.X_ADMIN)
public void putLogger(@Validated @RequestBody LoggerDto loggerDto) {
    loggerService.changeLevel(loggerDto);
}