List of usage examples for org.springframework.http HttpStatus OK
HttpStatus OK
To view the source code for org.springframework.http HttpStatus OK.
Click Source Link
From source file:com.netflix.scheduledactions.web.controllers.ValidationController.java
@RequestMapping(value = "/validateCronExpression", method = RequestMethod.GET) @ResponseStatus(value = HttpStatus.OK) public Map<String, Object> validateCronExpression(@RequestParam String cronExpression) { ImmutableMap.Builder<String, Object> mapBuilder = ImmutableMap.builder(); try {//from www . j a v a2 s. com TriggerUtils.validateCronExpression(cronExpression); mapBuilder.put("response", "Cron expression is valid"); try { Options options = new Options(); options.setZeroBasedDayOfWeek(false); mapBuilder.put("description", CronExpressionDescriptor.getDescription(cronExpression, options)); } catch (ParseException IGNORED) { mapBuilder.put("description", "No description available"); } return mapBuilder.build(); } catch (IllegalArgumentException e) { throw new InvalidCronExpressionException( String.format("Cron expression '%s' is not valid: %s", cronExpression, e.getMessage())); } }
From source file:com.javiermoreno.springboot.mvc.minimal.httpd.PingController.java
@RequestMapping(value = "/short", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) @ResponseBody//from www. j a v a2s.c o m String[] shortPing() { return new String[] { String.format("Current server time: %s.", new Date()) }; }
From source file:com.ge.predix.acs.commons.web.RestApiExceptionTest.java
@Test public void testRestApiExceptionDefaultConstructor() { RestApiException apiException = new RestApiException(); apiException.setAppErrorCode("code"); apiException.setHttpStatusCode(HttpStatus.OK); Assert.assertEquals(apiException.getAppErrorCode(), "code"); Assert.assertEquals(apiException.getHttpStatusCode(), HttpStatus.OK); Assert.assertEquals(apiException.getMessage(), null); Assert.assertEquals(apiException.getCause(), null); }
From source file:br.ufc.deti.ecgweb.application.controller.LoginController.java
@RequestMapping(value = "login", method = RequestMethod.POST, consumes = "application/json", produces = "application/json") @ResponseBody// w w w . jav a 2 s.c o m @ResponseStatus(HttpStatus.OK) public LoginResponseDTO getLogin(@RequestBody LoginDTO login) { Login login_ = service.loginSystem(login.getLogin(), login.getPassword()); return Converters.converterLoginToLoginResponseDTO(login_); }
From source file:com.gong.illidan.rest.controller.UserController.java
/** * GET /users -> get all the users/*from w w w. j a v a2 s . c o m*/ */ @RequestMapping(value = "/test", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<User> test() { log.info("REST request to test"); return new ResponseEntity<>(userService.getUser(1), HttpStatus.OK); }
From source file:org.cloudfoundry.identity.uaa.integration.HealthzEndpointIntegrationTests.java
/** * tests a happy-day flow of the <code>/healthz</code> endpoint *//* www . j a va 2s . c o m*/ @Test public void testHappyDay() throws Exception { HttpHeaders headers = new HttpHeaders(); ResponseEntity<String> response = serverRunning.getForString("/healthz/", headers); assertEquals(HttpStatus.OK, response.getStatusCode()); String body = response.getBody(); assertTrue(body.contains("ok")); }
From source file:com.tribuo.backend.controllers.ProductosTiendasController.java
/** * * @return/*from w ww . j ava 2s .c o m*/ */ @RequestMapping(value = "/all", method = RequestMethod.GET) @ResponseBody public ResponseEntity<List<ProductosTiendas>> getProductosTiendas() { List<ProductosTiendas> u = se.getProductosTiendas(); return new ResponseEntity<>(u, HttpStatus.OK); }
From source file:com.ar.dev.tierra.api.controller.TemporadaController.java
@RequestMapping(value = "/list", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<?> getAll() { List<Temporada> temporadas = facadeService.getTemporadaDAO().getAll(); if (!temporadas.isEmpty()) { return new ResponseEntity<>(temporadas, HttpStatus.OK); } else {//from ww w .j a v a2 s.c o m return new ResponseEntity<>(HttpStatus.BAD_REQUEST); } }
From source file:net.paulgray.bbrest.web.ConfigController.java
@RequestMapping(value = "/info", method = RequestMethod.GET) public ResponseEntity configView() { final SystemInfoService bbInfo = SystemInfoServiceFactory.getInstance(); return new ResponseEntity(new Object() { public JvmInfo jvmInfo = bbInfo.getJvmInfo(); public OsInfo osInfo = bbInfo.getOsInfo(); public String app = "BbRest"; public String version = "1.0.0-SNAPSHOT"; public Date time = new Date(); }, HttpStatus.OK); }
From source file:monkeys.web.MonkeysController.java
@RequestMapping(method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<List<Monkey>> getAllMonkeys() { List<Monkey> monkeyList = (List<Monkey>) monkeyRepository.findAll(); HttpHeaders headers = new HttpHeaders(); return new ResponseEntity<>(monkeyList, headers, HttpStatus.OK); }