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.tribuo.backend.controllers.CategoriasController.java

/**
 *
 * @param categoria/*from w ww.  j a v a2s.c  om*/
 * @return
 */
@RequestMapping(value = "/insert", method = RequestMethod.POST)
public ResponseEntity<Void> insertCategoria(@RequestBody Categorias categoria) {
    se.insertCategoria(categoria);
    return new ResponseEntity<>(HttpStatus.CREATED);
}

From source file:de.hska.ld.core.controller.RoleControllerIntegrationTest.java

@Test
public void testSaveRoleUsesHttpCreatedOnPersist() throws Exception {

    HttpResponse response = UserSession.admin().post(RESOURCE_ROLE, newRole());
    Assert.assertEquals(HttpStatus.CREATED, ResponseHelper.getStatusCode(response));
    Role createdRole = ResponseHelper.getBody(response, Role.class);
    Assert.assertNotNull(createdRole);/*from   w w  w .j a  va2 s .c o  m*/
    Assert.assertNotNull(createdRole.getId());
}

From source file:com.envision.envservice.rest.ClgApplicationResource.java

/**
 * ???/* w  w  w  .j  av a2 s  .  com*/
 * 
 * */
@GET
@Path("/queryAll")
@Produces(MediaType.APPLICATION_JSON)
public Response queryAll() throws Exception {
    HttpStatus status = HttpStatus.CREATED;
    String response = StringUtils.EMPTY;
    List<ClgApplication> list = clgApplicationService.queryClgApplication();
    response = JSONObject.toJSONString(list, JSONFilter.UNDERLINEFILTER);
    return Response.status(status.value()).entity(response).build();
}

From source file:com.tribuo.backend.controllers.UsuariosController.java

/**
 *
 * @param p//from  w  ww . java 2s .co m
 * @return
 */
@RequestMapping(value = "/insert", method = RequestMethod.POST)
public ResponseEntity<Void> insertUsuario(@RequestBody User p) {
    se.createUsuario(p);
    return new ResponseEntity<>(HttpStatus.CREATED);
}

From source file:de.hska.ld.core.controller.UserControllerIntegrationTest.java

@Test
public void testSaveUserUsesHttpCreatedOnPersist() throws Exception {
    User newUser = newUser();//  w ww .j  a v a  2 s  . c  o  m
    HttpResponse response = UserSession.admin().post(RESOURCE_USER, newUser);
    Assert.assertEquals(HttpStatus.CREATED, ResponseHelper.getStatusCode(response));

    /*
    UserSession userBSession = new UserSession();
    userBSession = userBSession.login(newUser.getUsername(), "pass");
    HttpResponse authenticationResponse = userBSession.get(RESOURCE_USER + "/authenticate");
    Assert.assertEquals(HttpStatus.OK, ResponseHelper.getStatusCode(authenticationResponse));*/
}

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

/**
 * Adds a new VNF software Image to the datacenter repository
 *
 * @param vimInstance : Image to add//from   w  w  w .  ja v a 2  s. c  o  m
 * @return datacenter: The datacenter filled with values from the core
 */
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseStatus(HttpStatus.CREATED)
public VimInstance create(@RequestBody @Valid VimInstance vimInstance,
        @RequestHeader(value = "project-id") String projectId)
        throws VimException, PluginException, EntityUnreachableException, IOException {
    return vimManagement.add(vimInstance, projectId);
}

From source file:com.tribuo.backend.controllers.FabricantesController.java

/**
 *
 * @param fabricante/*from   w  w w.  ja v a  2s .co m*/
 * @return
 */
@RequestMapping(value = "/insert", method = RequestMethod.POST)
public ResponseEntity<Void> insertFabricante(@RequestBody Fabricantes fabricante) {
    se.createFabricante(fabricante);
    return new ResponseEntity<>(HttpStatus.CREATED);
}

From source file:com.tribuo.backend.controllers.SubcategoriasController.java

/**
 *
 * @param p/*from   w  ww .j a va2s . c om*/
 * @return
 */
@RequestMapping(value = "/insert", method = RequestMethod.POST)
public ResponseEntity<Void> insertSubcategoria(@RequestBody Subcategorias p) {
    se.createSubcategoria(p);
    return new ResponseEntity<>(HttpStatus.CREATED);
}

From source file:com.tribuo.backend.controllers.PresentacionesController.java

/**
 *
 * @param p//from   ww w.  j a v a 2 s  . com
 * @return
 */
@RequestMapping(value = "/insert", method = RequestMethod.POST)
public ResponseEntity<Void> insertPresentacion(@RequestBody Presentaciones p) {
    se.createPresentacion(p);
    return new ResponseEntity<>(HttpStatus.CREATED);
}

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

/**
 * Adds a new EventEndpoint to the EventEndpoint repository
 *
 * @param endpoint : Image to add/*w  w  w  .jav  a 2 s.  c  o m*/
 * @return image: The image filled with values from the core
 */
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseStatus(HttpStatus.CREATED)
public EventEndpoint register(@RequestBody @Valid EventEndpoint endpoint,
        @RequestHeader(value = "project-id") String projectId) {
    endpoint.setProjectId(projectId);
    return eventDispatcher.register(gson.toJson(endpoint));
}