List of usage examples for org.springframework.http ResponseEntity status
Object status
To view the source code for org.springframework.http ResponseEntity status.
Click Source Link
From source file:br.com.s2it.snakes.controllers.CarController.java
@CrossOrigin("*") @RequestMapping(value = "/reservation", method = RequestMethod.POST) public ResponseEntity<CarReservation> createReservation(@RequestBody CarReservation reservation) { if (reservation == null || reservation.getLicensePlate() == null || reservation.getLicensePlate() == null || reservation.getCustomer() == null || reservation.getDestiny() == null || reservation.getPassengers() <= 0 || reservation.getInitialReservationDate() == null || reservation.getFinalReservationDate() == null) { return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(null); }//from w w w .j av a2 s . c o m try { boolean reservationIsPossible = service.reservationIsPossible(reservation.getLicensePlate(), reservation.getInitialReservationDate(), reservation.getFinalReservationDate()); if (reservationIsPossible) { return ResponseEntity.status(HttpStatus.OK).body(service.createReservation(reservation)); } else { return ResponseEntity.status(HttpStatus.CONFLICT).body(null); } } catch (Exception e) { return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(null); } }
From source file:com.yoncabt.ebr.ws.ReportWS.java
@RequestMapping(value = { "/ws/1.0/error/{requestId}" }, method = RequestMethod.GET, produces = "text/plain") public ResponseEntity<String> error(@PathVariable("requestId") String requestId) throws IOException { return ResponseEntity.status(HttpStatus.OK).body(reportService.error(requestId)); }
From source file:de.unimannheim.spa.process.rest.ProjectRestController.java
@RequestMapping(value = "/{projectID}/processes", method = RequestMethod.GET) public ResponseEntity<Map<String, Object>> getAllProcesses(@PathVariable String projectID) { return spaService.findProjectById(PROJECT_BASE_URL + projectID).map(project -> project.getDataPools()) .map(processes -> {//from www. j a va2 s . c o m return ResponseEntity.ok().contentType(JSON_CONTENT_TYPE) .body(serializeDataPool(processes.get(0).getDataBuckets())); }).orElseGet(() -> ResponseEntity.status(HttpStatus.NOT_FOUND).contentType(JSON_CONTENT_TYPE) .body(Collections.emptyMap())); }
From source file:com.github.lynxdb.server.api.http.handlers.EpQuery.java
@RequestMapping(path = "/last", method = { RequestMethod.GET, RequestMethod.POST }, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity last(QueryRequest _request) { return ResponseEntity.status(HttpStatus.NOT_IMPLEMENTED).build(); }
From source file:com.haulmont.restapi.idp.IdpAuthController.java
@GetMapping(value = "/v2/idp/login") public ResponseEntity login(@RequestParam(value = "redirectUrl", required = false) String redirectUrl) { if (!idpConfig.getIdpEnabled()) { log.debug("IDP authentication is disabled. Property cuba.rest.idp.enabled is false"); throw new InvalidGrantException("IDP is not supported"); }/*from w w w . j a v a 2 s .c om*/ if (redirectUrl == null) { redirectUrl = idpDefaultRedirectUrl; } if (redirectUrl == null) { log.debug("IDP defaultRedirectUrl is not set. Client did not provide redirectUrl parameter"); return ResponseEntity.status(HttpStatus.BAD_REQUEST) .body(new OAuth2Exception("Client did not provide redirectUrl parameter")); } return ResponseEntity.status(HttpStatus.FOUND).location(URI.create(getIdpLoginUrl(redirectUrl))).build(); }
From source file:com.yoncabt.ebr.ws.ReportWS.java
@RequestMapping(value = { "/ws/1.0/request" }, method = RequestMethod.POST, produces = "application/json", consumes = "application/json") @SuppressWarnings("ThrowableResultIgnored") public ResponseEntity<ReportResponse> request(@RequestBody(required = true) ReportRequest req) { ReportTask res = reportService.request(req); return ResponseEntity.status(res.getStatus().getHttpStatus()).body(res.getResponse()); }
From source file:com.github.ukase.web.UkaseController.java
@RequestMapping(value = "/bulk/{uuid}", method = RequestMethod.GET, produces = "application/pdf") public ResponseEntity<byte[]> getBulk(@PathVariable String uuid) throws IOException { byte[] bulk = bulkRenderer.getOrder(uuid); if (bulk == null) { return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(null); }/* w ww. j a v a 2 s . c o m*/ return ResponseEntity.ok(bulk); }
From source file:com.haulmont.restapi.idp.IdpAuthController.java
@GetMapping(value = "/v2/idp/status") public ResponseEntity status() { if (!idpConfig.getIdpEnabled()) { log.debug("IDP authentication is disabled. Property cuba.rest.idp.enabled is false"); throw new InvalidGrantException("IDP is not supported"); }//from ww w .ja va2s. co m return ResponseEntity.status(HttpStatus.FOUND).location(URI.create(getIdpStatusUrl())).build(); }
From source file:com.github.ukase.web.UkaseController.java
@RequestMapping(value = "/bulk/status/{uuid}", method = RequestMethod.GET) public ResponseEntity<String> getBulkState(@PathVariable String uuid) throws IOException { BulkStatus status = bulkRenderer.checkStatus(uuid); switch (status) { case PROCESSED: return ResponseEntity.status(bulkConfig.statusProcessed()).body(BULK_RESPONSE_READY); case ORDERED: return ResponseEntity.status(bulkConfig.statusOrdered()).body(BULK_RESPONSE_PROCESSING); }/* w w w . ja va2 s .c o m*/ return ResponseEntity.status(bulkConfig.statusError()).body(BULK_RESPONSE_ERROR); }
From source file:br.com.s2it.snakes.controllers.CarController.java
@CrossOrigin("*") @RequestMapping(value = "/reservations", method = RequestMethod.GET) public ResponseEntity<List<CarForReservationVO>> listAllReservations() { List<CarReservation> reservations = service.listAllReservations(); List<CarForReservationVO> vos = new ArrayList<>(); if (reservations != null && !reservations.isEmpty()) { for (CarReservation reservation : reservations) { Car car;/* w w w. j a va 2 s . c om*/ try { car = service.findByLicensePlate(reservation.getLicensePlate()); } catch (Exception e) { return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(null); } if (car == null) return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(null); CarForReservationVO crvo = new CarForReservationVO(); crvo.setPassengers(reservation.getPassengers()); crvo.setReservationId(reservation.getId()); crvo.setId(car.getId()); crvo.setModel(car.getModel()); crvo.setName(car.getName()); crvo.setPicture(car.getPicture()); crvo.setLicensePlate(car.getLicensePlate()); vos.add(crvo); } } return ResponseEntity.ok(vos); }