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:com.artivisi.salary.payroll.system.controller.LemburController.java

@RequestMapping(value = "/lembur/{id}", method = RequestMethod.PUT)
public void editLembur(@PathVariable String id, @RequestBody Lembur l) throws Exception {
    Lembur lembur = lemburService.findOne(id);
    if (lembur == null) {
        throw new Exception("User tidak ditemukan");
    }/* w  w  w.j a  v a 2s.  c  o m*/

    l.setId(lembur.getId());
    lemburService.save(l);
}

From source file:com.mycompany.dvdmvc.controllers.DVDController.java

@RequestMapping(value = "/", method = RequestMethod.PUT)
@ResponseBody/*ww  w . j av  a  2 s .c o m*/
public DVD edit(@Valid @RequestBody DVD dvd) {

    dao.update(dvd);

    return dvd;

    //        return "redirect:/";
}

From source file:com.hp.autonomy.frontend.find.idol.configuration.IdolConfigurationController.java

@SuppressWarnings("ProhibitedExceptionDeclared")
@RequestMapping(value = "/config", method = { RequestMethod.POST, RequestMethod.PUT })
public ResponseEntity<?> saveConfig(@RequestBody final IdolFindConfigWrapper configResponse) throws Exception {
    log.info(Markers.AUDIT, "REQUESTED UPDATE CONFIGURATION");

    try {//from ww w  .  j ava 2  s .  c o  m
        configService.updateConfig(configResponse.getConfig());
        final Object response = configService.getConfigResponse();
        log.info(Markers.AUDIT, "UPDATED CONFIGURATION");
        return new ResponseEntity<>(response, HttpStatus.OK);
    } catch (final ConfigException ce) {
        return new ResponseEntity<>(Collections.singletonMap("exception", ce.getMessage()),
                HttpStatus.NOT_ACCEPTABLE);
    } catch (final ConfigValidationException cve) {
        return new ResponseEntity<>(Collections.singletonMap("validation", cve.getValidationErrors()),
                HttpStatus.NOT_ACCEPTABLE);
    }
}

From source file:com.oracle.weblogic.examples.spring.jmx.WebLogicRESTJMXProxy.java

@RequestMapping(value = "/att/{namespace}/{beanName}/{attName}", method = RequestMethod.PUT)
@ResponseBody/*from   www . j  ava2s  .  co m*/
public String setAttributeValueFromPUT(@RequestBody String newValue,
        @PathVariable("namespace") String namespace, @PathVariable("beanName") String beanName,
        @PathVariable("attName") String attName) {
    ObjectNameWrapper beanObjectNameWrapper = new ObjectNameWrapper();
    beanObjectNameWrapper.setBeanName(beanName);
    beanObjectNameWrapper.setNamespace(namespace);

    StringBuilder sb = new StringBuilder();

    try {
        proxy.setAttributeValue(beanObjectNameWrapper, attName, newValue);
        sb.append("Success!");
    } catch (Exception e) {
        StringWriter sw = new StringWriter();
        PrintWriter writer = new PrintWriter(sw);
        e.printStackTrace(writer);
        writer.flush();
        sb.append(sw.toString());
    }

    return sb.toString();
}

From source file:com.snv.calendar.CalendarController.java

/**
 * {@inheritDoc}//from  w  ww  .  ja va2  s . c  om
 */
@RequestMapping(method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Override
public Calendar put(@Valid @RequestBody final Calendar calendar) {
    return calendarService.put(calendar);
}

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

@RequestMapping(value = "/jabatan/{id}", method = RequestMethod.PUT)
public void editJabatan(@PathVariable String id, @RequestBody Jabatan j) throws Exception {
    Jabatan jabatan = jabatanService.findOne(id);
    if (jabatan == null) {
        throw new Exception("User tidak ditemukan");
    }/*from  ww w  .  ja  va2  s .c o  m*/

    j.setId(jabatan.getId());
    jabatanService.save(j);
}

From source file:se.likfarmenhet.garage.controller.VehicleController.java

@RequestMapping(value = "/update", method = RequestMethod.PUT)
public Vehicle updateVehicle(@RequestBody Vehicle vehicle) {
    //        if (vehicle.getVehicle_id() == null) {
    //            throw new RuntimeException("NOT FOUND");
    //        }//w  w w  . ja v  a2s  .  c  o  m

    Vehicle original = vehicleRepository.findByLicensePlate(vehicle.getLicensePlate());
    ;

    original.setManufacturer(vehicle.getManufacturer());
    original.setModel(vehicle.getModel());
    original.setModel_year(vehicle.getModel_year());
    original.setFuel(vehicle.getFuel());
    original.setOdometer(vehicle.getOdometer());

    return vehicleRepository.save(original);
}

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

@RequestMapping(value = SINGLE_URI_TEMPLATE, method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_VALUE)
@ResponseStatus(HttpStatus.NO_CONTENT)//from   w w w .j  a v a  2  s  .com
public void put(@PathVariable String serviceInstanceKey, @PathVariable String name,
        PEResource ipAddressRoleResource) {

    basicItemDelegate.put(ipAddressRoleResource.getItem(), true);
}

From source file:com.dhenton9000.birt.controllers.security.ApplicationsController.java

@RequestMapping(method = RequestMethod.PUT, path = "/save", produces = "application/json")
@ApiOperation(value = "Save An Application", notes = "Save changes to  an Application")
public Applications save(@RequestBody Applications app) {

    Integer id = app.getId();/*from  w  ww . j av a 2  s . c  o  m*/
    Applications foundApp = applicationsService.findOne(id);
    if (foundApp == null) {
        throw new ResourceNotFoundException("cannot find application [" + id + "]");
    }

    return applicationsService.save(app);
}

From source file:nl.surfnet.mujina.controllers.ServiceProviderAPI.java

@RequestMapping(value = { "/protocolBinding" }, method = RequestMethod.PUT)
@ResponseStatus(HttpStatus.NO_CONTENT)//www. j a va2 s .  c o m
@ResponseBody
public void setProtocolBinding(@RequestBody ProtocolBinding protocolBinding) {
    log.debug("Request to set protocolBinding to {}", protocolBinding.getValue());
    configuration.setProtocolBinding(protocolBinding.getValue());
}