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:org.ff4j.spring.boot.utilts.FeatureWebUtils.java

public static ResponseEntity<Boolean> getBooleanResponseEntityByHttpStatus(FeatureActions featureActions) {
    switch (featureActions) {
    case CREATED:
        return new ResponseEntity<>(TRUE, HttpStatus.CREATED);
    case UPDATED:
        return new ResponseEntity<>(TRUE, HttpStatus.ACCEPTED);
    default://from   www. ja v a  2 s.  co  m
        return new ResponseEntity<>(FALSE, HttpStatus.NO_CONTENT);
    }
}

From source file:fr.gmjgav.GooglePlacesManager.java

public static ListAndStatus getPlaces(BarRepository barRepository, Coordinates coord) {
    HttpStatus responseCode = HttpStatus.OK;
    List<Place> places = GOOGLE_CLIENT.getNearbyPlaces(coord.getLat(), coord.getLng(), RADIUS, LIMIT,
            Param.name("types").value("bar"));
    List<Bar> createdBars = new ArrayList<>();
    for (Place tmpPlace : places) {
        if (barRepository.findByReference(tmpPlace.getPlaceId()).isEmpty()) {
            Bar generatedBar = new Bar(tmpPlace.getName(), tmpPlace.getPlaceId());
            createdBars.add(generatedBar);
        }//from w w  w.ja v a 2s  .  c  o m
    }
    if (!createdBars.isEmpty()) {
        responseCode = HttpStatus.CREATED;
        barRepository.save(createdBars);
    }

    return new ListAndStatus(places, responseCode);
}

From source file:com.carlomicieli.jtrains.infrastructure.web.Responses.java

public static ResponseEntity<Void> created(Link location) {
    HttpHeaders headers = new HttpHeaders();
    headers.add("Location", location.getHref());
    return new ResponseEntity<>(headers, HttpStatus.CREATED);
}

From source file:com.xinferin.controller.CustomerController.java

@RequestMapping(value = "/add", method = RequestMethod.POST, consumes = "application/json")
@ResponseStatus(HttpStatus.CREATED)
public void addCustomer(@RequestBody Customer customer) {
    daoCustomer.add(customer);//from  w  ww .  j  a v  a2s  .  c  o m
}

From source file:com.xinferin.controller.RegistrationController.java

@RequestMapping(value = "/register", method = RequestMethod.POST, consumes = "application/json")
@ResponseStatus(HttpStatus.CREATED)
public void register(@RequestBody CustomerRegistration customerRegistration) throws Exception {
    daoCustomerRegistration.register(customerRegistration);
}

From source file:monkeys.web.MonkeysController.java

@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody/*from www.ja  v a  2  s  .  com*/
public ResponseEntity<Void> createMonkey(@RequestBody Monkey monkey) {
    monkeyRepository.save(monkey);
    HttpHeaders headers = new HttpHeaders();
    return new ResponseEntity<>(headers, HttpStatus.CREATED);
}

From source file:monkeys.web.BananasController.java

@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody/*from   w w  w. ja va2  s.c om*/
public ResponseEntity<Void> createBanana(@RequestBody Banana banana) {
    bananaRepository.save(banana);
    HttpHeaders headers = new HttpHeaders();
    return new ResponseEntity<>(headers, HttpStatus.CREATED);
}

From source file:io.github.howiefh.jeews.modules.sys.controller.SignupController.java

@RequestMapping(value = "", method = RequestMethod.POST)
@ResponseStatus(HttpStatus.CREATED)
public Map<String, Object> signup(@RequestBody User u) {
    u.setLocked(true);/*from w ww . j a v a 2s.  c  o m*/

    userService.save(u);

    Map<String, Object> map = new HashMap<String, Object>();
    map.put("msg", "????????");
    return map;
}

From source file:rest.RondaRestController.java

@RequestMapping(value = "/", method = RequestMethod.POST)
public ResponseEntity<?> guardarJugador(@RequestBody Ronda r) {
    LogicaRonda.registrarRonda(r);//from  w  ww .jav  a  2s. co m
    return new ResponseEntity<>(HttpStatus.CREATED);
}

From source file:com.xinferin.controller.ProductController.java

@RequestMapping(value = "/add", method = RequestMethod.POST, consumes = "application/json")
@ResponseStatus(HttpStatus.CREATED)
public void addProduct(@RequestBody Product product) {
    daoProduct.add(product);/*from ww  w  .j a  v  a 2 s.c  om*/
}