List of usage examples for org.springframework.http HttpStatus CREATED
HttpStatus CREATED
To view the source code for org.springframework.http HttpStatus CREATED.
Click Source Link
From source file:com.envision.envservice.rest.CommentTopResource.java
@POST @Consumes(MediaType.APPLICATION_JSON)/*from w ww . j av a 2 s .co m*/ @Produces(MediaType.APPLICATION_JSON) public Response commentTop(CommentTopVo commentTopVo) throws ServiceException { HttpStatus status = HttpStatus.CREATED; String response = StringUtils.EMPTY; commentTopService.commentTop(commentTopVo.getComment_id()); return Response.status(status.value()).entity(response).build(); }
From source file:com.agroservices.restcontrollers.ProductosRest.java
@RequestMapping(value = "/", method = RequestMethod.POST) public ResponseEntity<?> persist(@RequestBody Producto p) { try {//w ww .j ava 2 s .c o m pf.saveProducto(p); } catch (Exception e) { System.out.println(e.getMessage()); return new ResponseEntity<>(HttpStatus.CONFLICT); } return new ResponseEntity<>(HttpStatus.CREATED); }
From source file:org.fineract.module.stellar.StellarBridgeTestHelpers.java
public static String createBridge(final String tenantName, final String mifosAddress) { final AccountBridgeConfiguration newAccount = new AccountBridgeConfiguration(tenantName, getTenantToken(tenantName, mifosAddress), mifosAddress); final Response creationResponse = given().header(CONTENT_TYPE_HEADER).body(newAccount) .post("/modules/stellarbridge"); creationResponse.then().assertThat().statusCode(HttpStatus.CREATED.value()); return creationResponse.getBody().as(String.class, ObjectMapperType.GSON); }
From source file:fr.gmjgav.controller.ReportController.java
@RequestMapping(value = "/{barId}/{beerId}", method = POST) public ResponseEntity<?> post(@PathVariable long barId, @PathVariable long beerId) { Bar bar = barRepository.findOne(barId); Beer beer = beerRepository.findOne(beerId); if (reportRepository.findByBarIdAndBeerId(barId, beerId).isEmpty()) { Report report = new Report(bar, beer); reportRepository.save(report);/*from ww w . j av a2 s . c om*/ return new ResponseEntity<>(HttpStatus.CREATED); } return new ResponseEntity<>(HttpStatus.NO_CONTENT); }
From source file:org.openbaton.nfvo.vnfm_reg.impl.register.RestRegister.java
@RequestMapping(value = "/vnfm-register", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseStatus(HttpStatus.CREATED) public void receiveRegister(@RequestBody VnfmManagerEndpoint endpoint) { addManagerEndpoint(gson.toJson(endpoint)); }
From source file:com.salmon.security.xacml.demo.springmvc.rest.HTTPPopulatorsTest.java
@Test public void testCreateVehicle() { ResponseEntity<Vehicle> entity = this.createOneVehicle(); String path = entity.getHeaders().getLocation().getPath(); assertEquals(HttpStatus.CREATED, entity.getStatusCode()); Vehicle vehicle = entity.getBody();//from ww w . ja v a 2 s. co m LOG.info("The Vehicle PLATE is " + vehicle.getPlate()); LOG.info("The Location is " + entity.getHeaders().getLocation()); assertEquals("RE 11 ODH", vehicle.getPlate()); assertTrue(path.startsWith("/xacml/aggregators/dvla/vehicles/")); }
From source file:fr.mby.opa.pics.web.controller.SessionController.java
@ResponseBody @ResponseStatus(value = HttpStatus.CREATED) @RequestMapping(method = RequestMethod.POST) public Session createSessionJson(@Valid @RequestBody final Session session, @RequestParam final Long pictureId, @RequestParam final Long albumId, final HttpServletRequest request) throws Exception { Assert.notNull(session, "No Session supplied !"); Assert.notNull(pictureId, "No Picture Id supplied !"); Assert.notNull(albumId, "No Album Id supplied !"); final ProposalBranch branch = this.proposalManager.getSelectedBranch(albumId, request); final ProposalBag currentBag = branch.getHead(); final Session createdSession = this.sessionService.createSession(pictureId, currentBag.getId(), session.getName(), session.getDescription()); return createdSession; }
From source file:org.nubomedia.marketplace.api.RestApplication.java
/** * Adds a new Application to the marketplace * * @param application/*from w w w.ja v a 2s. c o m*/ * @return Application */ @RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseStatus(HttpStatus.CREATED) public Application create(@RequestBody @Valid Application application) { log.trace("Incoming request for adding a new Application: " + application); application.setId(null); application = applicationManagement.add(application); log.trace("Incoming request served for adding a new Application: " + application); return application; }
From source file:aka.pirana.springsecurity.web.controllers.UserResource.java
@RequestMapping(value = "", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseBody/*from w ww . j a va2 s. co m*/ public ResponseEntity<User> createUser(@RequestBody User user) { System.out.println("aka.pirana.springsecurity.web.controllers.UserResource.createUser()"); User savedUser = userService.create(user); return new ResponseEntity<User>(savedUser, HttpStatus.CREATED); }
From source file:com.nebhale.springone2014.web.GamesController.java
@RequestMapping(method = RequestMethod.POST, value = "") // TODO 2: CREATED Status Code @ResponseStatus(HttpStatus.CREATED) HttpHeaders createGame() {//from w w w.j a v a 2 s.c o m Game game = this.gameRepository.create(); HttpHeaders headers = new HttpHeaders(); // TODO 1: Location: /games/{gameId} headers.setLocation(linkTo(GamesController.class).slash(game.getId()).toUri()); return headers; }