List of usage examples for org.springframework.http ResponseEntity ok
public static <T> ResponseEntity<T> ok(T body)
From source file:com.example.web.CustomerRestController.java
@RequestMapping(method = POST, consumes = APPLICATION_JSON_VALUE) public ResponseEntity<?> post(@RequestBody CustomerDTO input) { return ResponseEntity.ok(customerRepository.save(new Customer(input.getFirstName(), input.getLastName()))); }
From source file:com.yoncabt.ebr.ws.ReportWS.java
@RequestMapping(value = { "/ws/1.0/dataSourceNames" }, method = RequestMethod.GET, produces = "application/json") public ResponseEntity<List<String>> dataSourceNames() { return ResponseEntity.ok(new ArrayList<String>(reportService.dataSourceNames())); }
From source file:example.users.UserController.java
/** * Receiving POST requests supporting both JSON and XML. * //from ww w . ja va 2 s .co m * @param user * @return */ @PostMapping(value = "/") HttpEntity<String> post(@RequestBody UserPayload user) { return ResponseEntity .ok(String.format("Received firstname: %s, lastname: %s", user.getFirstname(), user.getLastname())); }
From source file:jp.classmethod.example.berserker.web.RootController.java
@Transactional @RequestMapping(value = "/users", method = RequestMethod.GET) public ResponseEntity<?> users() { log.debug("users"); Iterable<User> users = userRepos.findAll(); return ResponseEntity.ok(users); }
From source file:io.pivotal.strepsirrhini.chaosloris.web.IndexController.java
@RequestMapping(method = GET, value = "/", produces = HAL_JSON_VALUE) ResponseEntity index() {//ww w . ja va2 s. com ResourceSupport resource = new ResourceSupport(); resource.add(linkTo(methodOn(IndexController.class).index()).withSelfRel()); resource.add(linkTo(ApplicationController.class).withRel("applications")); resource.add(linkTo(ChaosController.class).withRel("chaoses")); resource.add(linkTo(EventController.class).withRel("events")); resource.add(linkTo(ScheduleController.class).withRel("schedules")); return ResponseEntity.ok(resource); }
From source file:com.github.vanroy.cloud.dashboard.controller.RegistryController.java
/** * Return instance history registration/cancellation * @return List of registered/cancelled instances */// www . j a v a 2 s. c om @RequestMapping(value = "/api/registry/history", method = RequestMethod.GET) public ResponseEntity instancesHistory() { if (repository == null) { return ResponseEntity.notFound().build(); } return ResponseEntity.ok(ImmutableMap.of("lastRegistered", repository.getRegisteredInstanceHistory(), "lastCancelled", repository.getCanceledInstanceHistory())); }
From source file:pitayaa.nail.msg.core.license.controller.LicenseController.java
@RequestMapping(value = "licenses/{ID}", method = RequestMethod.PUT) public @ResponseBody ResponseEntity<?> updateLicense(@PathVariable("ID") UUID uid, @RequestBody License licenseBody) throws Exception { License license = licenseService.updateLicense(licenseBody); return ResponseEntity.ok(license); }
From source file:com.github.jmnarloch.spring.cloud.feign.app.resource.InvoiceResource.java
@RequestMapping(value = "invoices", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) ResponseEntity<List<Invoice>> saveInvoices(@RequestBody List<Invoice> invoices) { return ResponseEntity.ok(invoices); }
From source file:pitayaa.nail.msg.core.account.controller.AccountLicenseController.java
@RequestMapping(value = "/accountsLicense/{ID}", method = RequestMethod.POST) public @ResponseBody ResponseEntity<?> saveAccountLicenseModel(@RequestBody AccountLicense accLicenseBody, @PathVariable("ID") UUID uid) throws Exception { Optional<AccountLicense> accountLicense = accLicenseService.findOne(uid); if (!accountLicense.isPresent()) { return new ResponseEntity<>(HttpStatus.NOT_FOUND); }/* www . ja v a2 s . c o m*/ accLicenseBody = accLicenseService.save(accLicenseBody); return ResponseEntity.ok(accLicenseBody); }
From source file:com.example.web.NewRestController.java
@RequestMapping(method = POST, consumes = APPLICATION_JSON_VALUE) public ResponseEntity<Student> post(@RequestBody StudentDTO input) { System.out.println(input.getFirstName()); return ResponseEntity.ok(studentRepository.save(new Student(input.getFirstName(), input.getLastName()))); }