List of usage examples for org.springframework.http HttpStatus NO_CONTENT
HttpStatus NO_CONTENT
To view the source code for org.springframework.http HttpStatus NO_CONTENT.
Click Source Link
From source file:com.bennavetta.appsite.webapi.AuthController.java
@RequestMapping(value = "/user", method = POST) @ResponseStatus(HttpStatus.NO_CONTENT) public void createUser(@RequestBody User user) { // use the same domain object to avoid duplicating information userService.create(user.getUsername(), user.getPassword(), user.getRoles(), user.getPermissions()); }
From source file:com.mum.controller.CardRestController.java
@RequestMapping(value = "remove/{productId}", method = RequestMethod.PUT) @ResponseStatus(value = HttpStatus.NO_CONTENT) public void removeItem(@PathVariable String productId, HttpServletRequest request) { System.out.println("RemoveItem"); String sessionId = request.getSession(true).getId(); Card card = cardServiceImpl.read(sessionId); if (card == null) { cardServiceImpl.create(new Card(sessionId)); }/*from w w w. j a v a 2 s . co m*/ //Product product = productServiceImpl.getProductById(productId, 1); Product product = productServiceImpl.getProductById(productId); if (product == null) { // throw new IllegalArgumentException("some exception"); } card.removeCartItem(new CardItem(product)); cardServiceImpl.update(sessionId, card); }
From source file:com.walmart.gatling.AbstractRestIntTest.java
protected HttpStatus delete(String url) { ResponseEntity<Void> response = template.exchange(url, HttpMethod.DELETE, null, Void.class); HttpStatus code = response.getStatusCode(); if (code == HttpStatus.OK || code == HttpStatus.NO_CONTENT || code == HttpStatus.NOT_FOUND) return response.getStatusCode(); else {//from ww w .jav a2 s. com fail("Expected the delete response to be 200 or 404, but was " + code.value() + "(" + code.getReasonPhrase() + ")."); return null; //for compiler } }
From source file:io.openshift.booster.service.FruitController.java
@ResponseStatus(HttpStatus.NO_CONTENT) @DeleteMapping("/{id}") public void delete(@PathVariable("id") Integer id) { verifyFruitExists(id);/*from w w w . j ava 2 s .com*/ repository.delete(id); }
From source file:com.torchmind.stockpile.server.controller.v1.ProfileController.java
/** * <code>DELETE /v1/profile/{name}</code> * * Purges a profile from the cache.//from www . j av a2 s . c o m * * @param name a name or identifier. */ @ResponseStatus(HttpStatus.NO_CONTENT) @RequestMapping(path = "/{name}", method = RequestMethod.DELETE) public void purge(@Nonnull @PathVariable("name") String name) { if (UUID_PATTERN.matcher(name).matches()) { UUID identifier = UUID.fromString(name); this.profileService.purge(identifier); return; } this.profileService.purge(name); }
From source file:net.eusashead.hateoas.response.impl.PutResponseBuilderImplTest.java
@Test public void testAllHeaders() throws Exception { Entity entity = new Entity("foo"); Date now = new Date(1373571924000l); ResponseEntity<Void> response = builder.entity(entity).etag().lastModified(now).build(); Assert.assertNotNull(response);/*from w w w .ja v a2s .c o m*/ Assert.assertEquals(HttpStatus.NO_CONTENT, response.getStatusCode()); Assert.assertNull(response.getBody()); Assert.assertNotNull(response.getHeaders().getETag()); Assert.assertEquals("W/\"b0c689597eb9dd62c0a1fb90a7c5c5a5\"", response.getHeaders().getETag()); Assert.assertEquals(now.getTime(), response.getHeaders().getLastModified()); }
From source file:org.zalando.github.spring.MembersTemplate.java
@Override public boolean isMemberOfOrganization(String organization, String username) { Map<String, Object> uriVariables = new HashMap<>(); uriVariables.put("organization", organization); uriVariables.put("username", username); HttpStatus status = HttpStatus.NOT_FOUND; try {// ww w . j a v a2 s .c o m ResponseEntity<Void> responseEntity = getRestOperations() .getForEntity(buildUri("/orgs/{organization}/members/{username}", uriVariables), Void.class); status = responseEntity.getStatusCode(); } catch (HttpClientErrorException e) { // skip } return HttpStatus.NO_CONTENT.equals(status) ? true : false; }
From source file:com.swcguild.bluraymvc.controller.DisplayController.java
@RequestMapping(value = "/movie/{id}", method = RequestMethod.DELETE) @ResponseStatus(HttpStatus.NO_CONTENT) public void deleteMovie(@PathVariable("id") int id) { dao.removeMovie(id);//from w ww . ja v a 2 s . c o m }
From source file:com.github.shredder121.gh_event_api.handler.HmacBehaviorTest.java
@Test public void testHmacIncorrect() { given().headers("X-GitHub-Event", "create", "X-Hub-Signature", "bogus").and() .body(getBody(), restAssuredMapper).with().contentType(JSON).expect() .statusCode(HttpStatus.NO_CONTENT.value()).when().post(); }
From source file:org.openbaton.nfvo.api.RestVNFPackage.java
/** * Removes multiple VNFPackage from the VNFPackages repository * * @param ids: The List of the VNFPackage Id to be deleted * @throws NotFoundException, WrongAction *///from w w w . ja v a 2 s. c o m @RequestMapping(value = "/multipledelete", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE) @ResponseStatus(HttpStatus.NO_CONTENT) public void multipleDelete(@RequestBody @Valid List<String> ids, @RequestHeader(value = "project-id") String projectId) throws NotFoundException, WrongAction { for (String id : ids) vnfPackageManagement.delete(id, projectId); }