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.tomcat.SampleWebApplicationTest.java
@Test public void testHome() throws Exception { ResponseEntity<String> entity = testRestTemplate.getForEntity("/", String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); assertEquals("Hello, Secret Property: chupacabras", entity.getBody()); }
From source file:com.baidu.stqa.signet.web.action.ProjectAction.java
/** * /*ww w . jav a 2 s . c om*/ * * @return */ @RequestMapping(value = "/project", method = RequestMethod.GET) @ResponseBody public ResponseEntity<List<Project>> queryUserProjects() { doLog(null); String user = getUser(); List<Project> projectList = new ArrayList<Project>(); if (user != null) { projectList = projectService.listProject(user); } return new ResponseEntity<List<Project>>(projectList, HttpStatus.OK); }
From source file:com.isalnikov.controller.MessageController.java
@RequestMapping(value = { "/message/{code}" }, method = RequestMethod.GET) @ResponseBody/* w ww .java 2 s . com*/ public ResponseEntity index(@PathVariable("code") String code, Locale locale) { String result = messageSource.getMessage(code, new Object[] {}, locale); System.out.println(String.format("%s : %s", locale.getLanguage(), result)); String res = String.format("%s : %s", locale.getLanguage(), messageHelper.getMessage(code)); HttpHeaders headers = new HttpHeaders(); headers.add("Content-type", "application/json;charset=UTF-8"); ResponseEntity responseEntity = new ResponseEntity<>(res, headers, HttpStatus.OK); return responseEntity; }
From source file:com.allogy.amazonaws.elasticbeanstalk.worker.simulator.application.WorkerDaemonSimulator.java
public void process() { Stream<MessageWrapper> handledOk = queueManager.readQueue() .filter(m -> HttpStatus.OK.equals(workerApplication.forward(m))); queueManager.deleteMessages(handledOk); }
From source file:org.sharetask.controller.DummyControllerIT.java
@Test public void testIfAppIsUp() throws IOException { //given//from w w w .ja v a2 s .c o m HttpClient client = new DefaultHttpClient(); HttpGet httpget = new HttpGet(URL); //when HttpResponse response = client.execute(httpget); //then Assert.assertEquals(HttpStatus.OK.value(), response.getStatusLine().getStatusCode()); HttpEntity entity = response.getEntity(); if (entity != null) { String result = EntityUtils.toString(entity); Assert.assertEquals("OK", result); } else { Assert.fail("No content!"); } }
From source file:com.boxedfolder.carrot.web.client.AnalyticsResource.java
@ResponseStatus(HttpStatus.OK) @RequestMapping(value = "/count", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public Map<String, String> countEntities() { Map<String, String> output = new TreeMap<>(); output.put("beacons", Long.toString(service.countBeacons())); output.put("apps", Long.toString(service.countApps())); output.put("events", Long.toString(service.countEvents())); return output; }
From source file:gumga.framework.security.GumgaSoftwareValuesProxy.java
@Transactional @ResponseStatus(value = HttpStatus.OK) @ApiOperation(value = "delete", notes = "Deleta objeto com o id correspondente.") @RequestMapping(value = "/{id}", method = RequestMethod.DELETE) public RestResponse delete(@PathVariable Long id) { String url = getBaseUrl() + id + "?gumgaToken=" + GumgaThreadScope.gumgaToken.get(); try {/* ww w .j ava 2s . c om*/ RestTemplate restTemplate = null; getRestTemplate().delete(url); return new RestResponse("OK"); } catch (Exception ex) { return new RestResponse(ex); } }
From source file:com.tribuo.backend.controllers.UsuariosController.java
/** * * @return/*from ww w .j a va 2s .c o m*/ */ @RequestMapping(value = "/all", method = RequestMethod.GET) @ResponseBody public ResponseEntity<List<User>> getUsuarios() { List<User> u = se.getUsuarios(); return new ResponseEntity<>(u, HttpStatus.OK); }
From source file:io.syndesis.runtime.APIDocsITCase.java
@Test public void testSwaggerJsonWithToken() { ResponseEntity<JsonNode> response = get("/api/v1/swagger.json", JsonNode.class); assertThat(response.getStatusCode()).as("swagger json response code").isEqualTo(HttpStatus.OK); assertThat(response.getBody().get("paths").size()).as("swagger json number of paths").isPositive(); }
From source file:monkeys.web.BananasController.java
@RequestMapping(method = RequestMethod.GET, value = "/{id}", produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<Banana> getBanana(@PathVariable Long id) { Banana banana = bananaRepository.findOne(id); HttpHeaders headers = new HttpHeaders(); return new ResponseEntity<>(banana, headers, HttpStatus.OK); }