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.github.wnameless.spring.papertrail.test.jpa.JpaTestController.java

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

From source file:edu.eci.arsw.blindway.controller.UsuarioController.java

@RequestMapping(value = "/registro", method = RequestMethod.POST)
public ResponseEntity<?> manejadorPostRecursoUsuario(String nombre, int edad, String genero, String nickname,
        String contrasena, String correoElectronico) {
    try {//from  w w  w .j  av  a  2s  .c o  m
        stub.registroUsuario(nombre, edad, genero, nickname, contrasena, correoElectronico);
        return new ResponseEntity<>("El usuario fue creado satisfactoriamente.", HttpStatus.CREATED);
    } catch (RegistroUsuarioException ex) {
        return new ResponseEntity<>(ex.getMessage(), HttpStatus.NOT_ACCEPTABLE);
    }
}

From source file:rest.TorneoRestController.java

@RequestMapping(value = "/", method = RequestMethod.POST)
public ResponseEntity<?> guardarTorneo(@RequestBody Torneo t) {
    logicaTorneo.registrarTorneo(t);/*from   w ww  . j  a v  a 2 s .  c o m*/
    return new ResponseEntity<>(HttpStatus.CREATED);
}

From source file:com.blstream.patronage.ctf.common.web.controller.RestController.java

/**
 * This method creates a new document.// www.  ja va2s . c  o  m
 * @param resource
 * @return T
 */
@RequestMapping(method = RequestMethod.POST, consumes = { MediaType.APPLICATION_JSON_VALUE }, produces = {
        MediaType.APPLICATION_JSON_VALUE })
@ResponseStatus(HttpStatus.CREATED)
@ResponseBody
T create(@RequestBody T resource);

From source file:org.avidj.zuul.rs.ZuulTest.java

@Test
public void itShallCreateShallowReadLockOnRoot() {
    final Zuul zuul = createZuul();
    given().standaloneSetup(zuul).param("t", "r").param("s", "s").when().put("/s/1/").then()
            .statusCode(HttpStatus.CREATED.value());
    given().standaloneSetup(zuul).when().get("/s/1/").then().statusCode(HttpStatus.OK.value()).and()
            .body("key", hasItem(Collections.emptyList())).and().body("session", hasItem("1")).and()
            .body("type", hasItem("READ")).and().body("scope", hasItem("SHALLOW")).and()
            .body("count", hasItem(1));
}

From source file:com.orange.cloud.servicebroker.filter.core.service.ServiceInstanceBindingServiceProxyTest.java

private static ResponseEntity<CreateServiceInstanceAppBindingResponse> created() {
    return new ResponseEntity<CreateServiceInstanceAppBindingResponse>(
            new CreateServiceInstanceAppBindingResponse(), HttpStatus.CREATED);
}

From source file:com.ge.predix.acs.commons.web.ResponseEntityBuilderTest.java

@Test
public void testCreated() {
    ResponseEntity<Object> created = ResponseEntityBuilder.created();
    Assert.assertNotNull(created);//w  ww .j a v  a 2s . c o  m
    Assert.assertNull(created.getBody());
    Assert.assertEquals(created.getStatusCode(), HttpStatus.CREATED);
}

From source file:com.tsg.dvdlibrarymvc.RESTController.java

@RequestMapping(value = "/dvd", method = RequestMethod.POST)
@ResponseStatus(HttpStatus.CREATED)
@ResponseBody//w w w.  j  a  va  2s .co m
public DVD createDvd(@Valid @RequestBody DVD dvd) {
    return dao.addDVD(dvd);

}

From source file:org.elasticstore.server.controller.ItemController.java

@RequestMapping(method = RequestMethod.POST)
@ResponseStatus(HttpStatus.CREATED)
public void createItem(@RequestBody final Item item) throws ElasticStoreException {
    itemService.saveOrUpdateItem(item);//from w  w w .j av a2s. c  om
}

From source file:com.budiana.irpan.belajar.controller.PesertaController.java

@RequestMapping(value = "/peserta", method = RequestMethod.POST)
@ResponseStatus(HttpStatus.CREATED)
public void insertPesertaBaru(@RequestBody @Valid Peserta p) {
    pd.save(p);
}