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.consol.citrus.demo.javaland.EmployeeMailTest.java
@Test @CitrusTest/*from ww w . j av a2 s. c o m*/ public void testPostWithWelcomeEmail(@CitrusResource TestDesigner citrus) { citrus.variable("employee.name", "Rajesh"); citrus.variable("employee.age", "20"); citrus.variable("employee.email", "rajesh@example.com"); citrus.http().client(serviceUri).post().fork(true).contentType(MediaType.APPLICATION_FORM_URLENCODED) .payload("name=${employee.name}&age=${employee.age}&email=${employee.email}"); citrus.receive(mailServer).payload(new ClassPathResource("templates/welcome-mail.xml")) .header(CitrusMailMessageHeaders.MAIL_SUBJECT, "Welcome new employee") .header(CitrusMailMessageHeaders.MAIL_FROM, "employee-registry@example.com") .header(CitrusMailMessageHeaders.MAIL_TO, "${employee.email}"); citrus.send(mailServer).payload(new ClassPathResource("templates/welcome-mail-response.xml")); citrus.http().client(serviceUri).response(HttpStatus.NO_CONTENT); citrus.http().client(serviceUri).get().accept(MediaType.APPLICATION_XML); citrus.http().client(serviceUri).response(HttpStatus.OK) .payload("<employees>" + "<employee>" + "<age>${employee.age}</age>" + "<name>${employee.name}</name>" + "<email>${employee.email}</email>" + "</employee>" + "</employees>"); citrusFramework.run(citrus.getTestCase()); }
From source file:com.thesoftwareguild.capstoneblog.controller.StaticPageController.java
@RequestMapping(value = "/page/{id}", method = RequestMethod.PUT) @ResponseStatus(HttpStatus.NO_CONTENT) public void editPage(@PathVariable("id") int id, @RequestBody Page page) { Page p = dao.getPageById(id);/*from ww w. j av a2 s .co m*/ p.setContent(page.getContent()); p.setTitle(page.getTitle()); dao.updatePage(p); }
From source file:io.curly.gathering.item.ItemController.java
@RequestMapping(value = "/delete/artifact/{artifact}", method = RequestMethod.DELETE) public Callable<HttpEntity<?>> removeItem(@PathVariable String listId, @PathVariable String artifact, @GitHubAuthentication User user) { return () -> { this.interaction.removeItem(new RemovableItem(artifact, listId, ItemType.ARTIFACT), user); return new ResponseEntity<>(HttpStatus.NO_CONTENT); };//from ww w . j ava 2 s . com }
From source file:edu.mum.waa.webstore.controller.CartRestController.java
@RequestMapping(value = "/remove/{productId}", method = RequestMethod.PUT) @ResponseStatus(value = HttpStatus.NO_CONTENT) public void removeItem(@PathVariable String productId, HttpServletRequest request) { String sessionId = request.getSession(true).getId(); Cart cart = cartService.read(sessionId); if (cart == null) { cartService.create(new Cart(sessionId)); }/*from w w w.j a v a2s .c o m*/ Product product = productService.getProductById(productId); if (product == null) { throw new IllegalArgumentException(String.format("Product with id (%) not found", productId)); } cart.removeCartItem(new CartItem(product)); cartService.update(sessionId, cart); }
From source file:cn.designthoughts.sample.axon.sfav.customer.controller.CustomerController.java
@RequestMapping(value = "/rest/customers", method = RequestMethod.POST) @ResponseStatus(value = HttpStatus.NO_CONTENT) public void createCustomer(@RequestBody @Valid CreateCustomerRequest request) { String creationDate = new Date().toString(); Status status = Status.INACTIVE; if (request.getStatus() != null) { status = request.getStatus();//from w ww.ja v a 2 s. com } commandGateway.send(new CreateCustomerCommand(request.getCustomerId(), request.getPasswordHash(), request.getNickName(), request.getLegalName(), request.getAvatarUrl(), request.getPersonalHomePageUrl(), request.getMobileNumber(), request.getRole(), request.getCategory(), status, request.getEmailAddress(), creationDate)); return; }
From source file:com.wisemapping.rest.AccountController.java
@RequestMapping(method = RequestMethod.PUT, value = "account/firstname", consumes = { "text/plain" }) @ResponseStatus(value = HttpStatus.NO_CONTENT) public void changeFirstname(@RequestBody String firstname) { if (firstname == null) { throw new IllegalArgumentException("Firstname can not be null"); }//from ww w.j a v a2 s .co m final User user = Utils.getUser(true); user.setFirstname(firstname); userService.updateUser(user); }
From source file:sample.mvc.SessionController.java
@RequestMapping(value = "/sessions/", method = RequestMethod.DELETE, produces = { MediaType.APPLICATION_JSON_VALUE, "application/hal+json" }) public HttpStatus removeSession(Principal principal, @RequestHeader("x-auth-token") String sessionIdToDelete) { Set<String> usersSessionIds = sessions.findByPrincipalName(principal.getName()).keySet(); if (usersSessionIds.contains(sessionIdToDelete)) { sessions.delete(sessionIdToDelete); }/*from w w w. jav a 2 s .c om*/ return HttpStatus.NO_CONTENT; }
From source file:de.sainth.recipe.backend.rest.controller.RecipeController.java
@Secured({ "ROLE_USER", "ROLE_ADMIN" }) @RequestMapping("{id}") HttpEntity<Recipe> get(@PathVariable("id") Long id) { Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); if (authentication instanceof RecipeManagerAuthenticationToken) { RecipeManagerAuthenticationToken token = (RecipeManagerAuthenticationToken) authentication; Recipe recipe = repository.findOne(id); if (recipe == null) { return new ResponseEntity<>(HttpStatus.NO_CONTENT); } else if (recipe.isPublicVisible() || ROLE_ADMIN.name().equals(token.getRole()) || token.getPrincipal().equals(recipe.getAuthor().getId())) { return new ResponseEntity<>(recipe, HttpStatus.OK); }/*from ww w . j a va 2 s.com*/ } return new ResponseEntity<>(HttpStatus.FORBIDDEN); }
From source file:org.openbaton.nfvo.api.RestEvent.java
/** * Removes multiple EventEndpoint from the EventEndpoint repository * * @param ids: The List of the EventEndpoint Id to be deleted * @throws NotFoundException/* ww w.j a va 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 { for (String id : ids) eventDispatcher.unregister(id, projectId); }
From source file:com.consol.citrus.samples.javaee.employee.EmployeeMailTest.java
@Test @CitrusTest/*from w w w . j ava2s.co m*/ public void testPostWithWelcomeEmail(@CitrusResource TestDesigner citrus) { citrus.variable("employee.name", "Rajesh"); citrus.variable("employee.age", "20"); citrus.variable("employee.email", "rajesh@example.com"); citrus.http().client(serviceUri).send().post().fork(true).contentType(MediaType.APPLICATION_FORM_URLENCODED) .payload("name=${employee.name}&age=${employee.age}&email=${employee.email}"); citrus.receive(mailServer).payload(new ClassPathResource("templates/welcome-mail.xml")) .header(CitrusMailMessageHeaders.MAIL_SUBJECT, "Welcome new employee") .header(CitrusMailMessageHeaders.MAIL_FROM, "employee-registry@example.com") .header(CitrusMailMessageHeaders.MAIL_TO, "${employee.email}"); citrus.send(mailServer).payload(new ClassPathResource("templates/welcome-mail-response.xml")); citrus.http().client(serviceUri).receive().response(HttpStatus.NO_CONTENT); citrus.http().client(serviceUri).send().get().accept(MediaType.APPLICATION_XML); citrus.http().client(serviceUri).receive().response(HttpStatus.OK) .payload("<employees>" + "<employee>" + "<age>${employee.age}</age>" + "<name>${employee.name}</name>" + "<email>${employee.email}</email>" + "</employee>" + "</employees>"); citrusFramework.run(citrus.getTestCase()); }