Example usage for org.springframework.http HttpStatus CREATED

List of usage examples for org.springframework.http HttpStatus CREATED

Introduction

In this page you can find the example usage for org.springframework.http HttpStatus CREATED.

Prototype

HttpStatus CREATED

To view the source code for org.springframework.http HttpStatus CREATED.

Click Source Link

Document

201 Created .

Usage

From source file:com.mycompany.geocoordinate.controller.PointController.java

@ResponseStatus(HttpStatus.CREATED)
@PostMapping(value = "/point", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public @ResponseBody ResponseEntity<List<Integer>> point(@RequestBody GeoObject geoObject)
        throws IOException, JSONException {

    boolean check = coordinateMapper.isThereGeoObjectFromCircleType(GeoType.GEOPOINT) != null
            & coordinateMapper.selectCoordinateForLineorCircle(geoObject.getCoordinate()) != null;

    coordinateMapper.insertCoordinateForLineorCircle(GeoType.GEOPOINT, geoObject.getCoordinate());

    List<Integer> responseType = coordinateMapper.selectIdGeo(geoObject.getCoordinate());

    return ResponseEntity.created(URI.create("/point/id")).body(responseType);

}

From source file:com.swcguild.dvdlibraryarch.controller.HomeController.java

@RequestMapping(value = "/dvd", method = RequestMethod.POST)
@ResponseStatus(HttpStatus.CREATED)
@ResponseBody//from  ww  w  .  j a v a  2s  .c  o  m
public Dvd createDvd(@Valid @RequestBody Dvd dvd) {
    // persist the incoming dvd
    dao.addDvd(dvd);
    // The addDvd call to the dao assigned a dvdId to the incoming // Dvd and set that value on the object. Now we return the updated // object to the caller.
    return dvd;
}

From source file:com.thesoftwareguild.addressbook.controller.HomeController.java

@RequestMapping(value = "/address", method = RequestMethod.POST)
@ResponseStatus(HttpStatus.CREATED)
@ResponseBody//from   w ww  . ja  va  2s  .co  m
public Address createAddress(@Valid @RequestBody Address address) {
    dao.addAddress(address);
    return address;
}

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

/**
 * <p>registerUser.</p>/*from   w ww .j  a v a  2s .c o  m*/
 *
 * @param userdata a {@link net.prasenjit.auth.model.UserRegistrationRequest} object.
 */
@RequestMapping(method = RequestMethod.PUT)
@ResponseStatus(HttpStatus.CREATED)
public void registerUser(@Validated @RequestBody UserRegistrationRequest userdata) {
    userservice.registerUser(userdata);
}

From source file:application.controllers.RestController.java

@RequestMapping(value = "/signup", method = RequestMethod.PUT)
public ResponseEntity<?> newAccount(@RequestBody String account) {
    if (myBatisService.getByName(account) != null) {
        return new ResponseEntity<>(HttpStatus.CONFLICT);
    } else {// w ww  .  j  av  a2 s .  c  o m
        Account newAccount = new Account();
        newAccount.setName(account);
        newAccount.setBalance(1000);
        myBatisService.insertAccount(newAccount);
    }
    return new ResponseEntity<>(HttpStatus.CREATED);
}

From source file:edu.eci.cosw.restcontrollers.ClienteRest.java

@RequestMapping(value = "/", method = RequestMethod.POST)
public ResponseEntity<?> persist(@RequestBody Cliente c) {
    if (sf.existeCliente(c.getIdcliente())) {
        return new ResponseEntity<>(HttpStatus.CONFLICT);
    } else {/*w  ww  . jav  a 2s.c o  m*/
        sf.guardarCliente(c);
    }
    return new ResponseEntity<>(HttpStatus.CREATED);
}

From source file:com.swcguild.addressbookarch.controller.HomeController.java

@RequestMapping(value = "/address", method = RequestMethod.POST)
@ResponseStatus(HttpStatus.CREATED)
@ResponseBody/*w w  w.  ja  v a2s  . c  o m*/
public Address createAddress(@Valid @RequestBody Address address) {
    // persist the incoming address
    dao.addAddress(address);
    // The addAddress call to the dao assigned a addressId to the incoming
    // Address and set that value on the object. Now we return the updated
    // object to the caller.
    return address;
}

From source file:com.github.wnameless.spring.papertrail.test.jpa.JpaTestController.java

@RequestMapping(value = "/before", method = RequestMethod.POST)
@ResponseBody
@ResponseStatus(HttpStatus.CREATED)
String before() {
    return "before";
}

From source file:be.boyenvaesen.RestControllers.HumidityRestController.java

@RequestMapping(path = "/humidity", method = RequestMethod.POST)
public ResponseEntity<Humidity> postNew(@RequestBody postObject<Float> hum) {
    return new ResponseEntity<>(service.addNew(hum), HttpStatus.CREATED);
}

From source file:org.openbaton.nfvo.api.RestVirtualLink.java

/**
 * Adds a new Configuration to the Configurations repository
 *
 * @param virtualLinkDescriptor//from   w  ww .  java 2s  .co m
 * @return virtualLinkDescriptor
 */
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseStatus(HttpStatus.CREATED)
public VirtualLinkDescriptor create(@RequestBody @Valid VirtualLinkDescriptor virtualLinkDescriptor) {
    log.trace("Adding VirtualLinkDescriptor: " + virtualLinkDescriptor);
    log.debug("Adding VirtualLinkDescriptor");
    return virtualLinkManagement.add(virtualLinkDescriptor);
}