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:sample.web.thymeleaf3.SampleWebThymeleaf3ApplicationTests.java
@Test public void testHome() throws Exception { ResponseEntity<String> entity = this.restTemplate.getForEntity("/", String.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); assertThat(entity.getBody()).contains("<title>Messages"); assertThat(entity.getBody()).doesNotContain("layout:fragment"); }
From source file:com.mycompany.springrest.controllers.RoleController.java
@RequestMapping(value = "/role", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<List<Role>> listRoles() { List<Role> roles = roleService.listRoles(); if (roles.isEmpty()) { return new ResponseEntity<List<Role>>(HttpStatus.NO_CONTENT); }//from w w w. j av a2 s .c o m return new ResponseEntity<List<Role>>(roles, HttpStatus.OK); }
From source file:edu.infsci2560.services.BlogsService.java
@RequestMapping(method = RequestMethod.POST, consumes = "application/json", produces = "application/json") public ResponseEntity<Blog> create(@RequestBody Blog blog) { HttpHeaders headers = new HttpHeaders(); return new ResponseEntity<>(repository.save(blog), headers, HttpStatus.OK); }
From source file:eu.cloudwave.wp5.feedbackhandler.controller.NewRelicController.java
@RequestMapping(Urls.NEW_RELIC__SUMMARIZE) @ResponseStatus(HttpStatus.OK) public MethodInfoSummarized summarize(@RequestHeader(Headers.X_API_KEY) final String apiKey, @RequestParam(Params.APPLICATION_ID) final String applicationId, @RequestParam(Params.CLASS_NAME) final String className, @RequestParam(Params.PROCEDURE_NAME) final String methodName) throws RequestException { final MetricSourceClient metricSourceClient = metricSourceClientProvider.getNewRelicClient(apiKey); try {// w w w . j av a2 s . co m return metricSourceClient.summarized(applicationId, className, methodName); } catch (final MetricSourceClientException e) { throw new RequestException(e.getType(), e.getMessage()); } }
From source file:de.codecentric.boot.admin.actuate.LogfileMvcEndpointTest.java
@Test public void logfile() throws IOException { try {// w w w .j a v a 2 s . c o m FileCopyUtils.copy("--TEST--".getBytes(), new File("test.log")); controller.setLogfile("test.log"); assertEquals(HttpStatus.OK, controller.available().getStatusCode()); MockHttpServletResponse response = new MockHttpServletResponse(); controller.invoke(response); assertEquals(HttpStatus.OK.value(), response.getStatus()); assertEquals("--TEST--", response.getContentAsString()); } finally { new File("test.log").delete(); } }
From source file:comsat.sample.jpa.SampleJpaApplicationTests.java
@Test public void testHome() throws Exception { ResponseEntity<String> entity = new TestRestTemplate().getForEntity("http://localhost:" + this.port, String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); // TODO Check that //tbody/tr count is 4 }
From source file:edu.sjsu.cmpe275.project.controller.ReportController.java
@RequestMapping(value = "/daily") public ResponseEntity<?> roomDailyReport(@RequestParam(value = "date", required = true) Date date) { RoomReportData result = null;/*from www. j a v a2 s. com*/ Date today = new Date(); int i = DateTool.compare(date, today); if (i == 0) { result = reportService.currentReport(date); } else if (i < 0) { result = reportService.postRport(date); } else { result = reportService.futureReprot(date); } return new ResponseEntity(result, HttpStatus.OK); }
From source file:ru.portal.controllers.RestController.java
@RequestMapping(value = { "/main" }) @ResponseBody// w w w .j a v a 2 s.c om public ResponseEntity<String> main() { HttpHeaders headers = new HttpHeaders(); headers.add("Content-type", "application/json;charset=UTF-8"); ResponseEntity responseEntity = new ResponseEntity<>("main", headers, HttpStatus.OK); return responseEntity; }
From source file:com.chevres.rss.restapi.controller.LogoutController.java
@CrossOrigin @RequestMapping(path = "/logout", method = RequestMethod.POST) @ResponseBody/*ww w. j av a 2 s .co m*/ public ResponseEntity<String> logout(@RequestHeader(value = "User-token") String userToken) { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring.xml"); UserAuthDAO userAuthDAO = context.getBean(UserAuthDAO.class); UserAuth userAuth = userAuthDAO.findByToken(userToken); if (userAuth == null) { context.close(); return new ResponseEntity(new ErrorMessageResponse("invalid_token"), HttpStatus.BAD_REQUEST); } userAuthDAO.delete(userAuth); context.close(); return new ResponseEntity(new SuccessMessageResponse("success"), HttpStatus.OK); }
From source file:com.fariz.muhammad.restful.controller.PermissionController.java
@RequestMapping(value = "/permission/{id}", method = RequestMethod.DELETE) @ResponseStatus(HttpStatus.OK) public void delete(@PathVariable String id) { Permission permission = permissionDao.findOne(id); permissionDao.delete(permission);/*from ww w . j a va 2 s . c om*/ }