Example usage for org.springframework.http HttpStatus OK

List of usage examples for org.springframework.http HttpStatus OK

Introduction

In this page you can find the example usage for org.springframework.http HttpStatus OK.

Prototype

HttpStatus OK

To view the source code for org.springframework.http HttpStatus OK.

Click Source Link

Document

200 OK .

Usage

From source file:net.eusashead.hateoas.conditional.interceptor.AsyncTestController.java

@RequestMapping(method = RequestMethod.HEAD)
public Callable<ResponseEntity<Void>> head() {
    return new Callable<ResponseEntity<Void>>() {

        @Override// w  ww.j a  v a  2  s.co m
        public ResponseEntity<Void> call() throws Exception {
            HttpHeaders headers = new HttpHeaders();
            headers.setETag("\"123456\"");
            return new ResponseEntity<Void>(headers, HttpStatus.OK);
        }
    };

}

From source file:com.itn.webservices.AdminControllerWebservice.java

@RequestMapping("/foods")
public ResponseEntity<List<FoodInventory>> findAllList() {
    List<FoodInventory> allFoodList = foodInventoryService.findAll();
    logger.info("size is {}", allFoodList.size());
    return new ResponseEntity<List<FoodInventory>>(allFoodList, HttpStatus.OK);
}

From source file:com.digitaslbi.helios.controllers.FileController.java

@RequestMapping(value = "/uploadObject", method = RequestMethod.POST)
@ResponseStatus(HttpStatus.OK)
public void uploadObject(@RequestParam("fileName") String fileName, @RequestParam("file") MultipartFile file) {
    try {//from  w w  w .j  av  a 2 s. c  o m
        delegate = new S3Delegate();
        byte[] content = file.getBytes();
        delegate.uploadObject(fileName, content);

        log.info("[FileController][uploadObject] File: " + fileName + " created.");
    } catch (IOException e) {
        log.error("[FileController][uploadObject] Error creating file: " + e);
    }
}

From source file:eu.modaclouds.sla.service.rest.PenaltyReceiverRest.java

@POST
@Produces(MediaType.TEXT_PLAIN)/*  w  w  w. j  a  va2  s.  c om*/
public Response postPenalty(Penalty penalty) {

    logger.debug(penalty.toString());

    if ("MAIL".equalsIgnoreCase(penalty.getDefinition().getType())) {
        sendMail(penalty);
    }

    return buildResponse(HttpStatus.OK, "Penalty received");
}

From source file:com.basicservice.controller.GeneralController.java

@RequestMapping(method = RequestMethod.GET)
@ResponseBody//  w w w.  j a  v  a  2s .co m
public ResponseEntity<String> runTest(HttpServletResponse response) {
    LOG.debug("Starting test write to db");
    boolean success = service.initReadWriteTest();
    LOG.debug("DB test write results: " + success);
    return new ResponseEntity<String>(success ? HttpStatus.OK : HttpStatus.SERVICE_UNAVAILABLE);
}

From source file:com.vividcode.imap.server.controller.UserController.java

@RequestMapping(method = RequestMethod.PUT)
@ResponseStatus(HttpStatus.OK)
@ResponseBody//from  w  ww.j a  va2 s  . c om
public ValidatedResponse update(@RequestBody @Valid UserVO user) {
    userService.updateUser(user);
    return new ValidatedResponse();
}

From source file:com.envision.envservice.rest.CourseResource.java

@GET
@Produces(MediaType.APPLICATION_JSON)//from   w w w.  j av a2s  .com
public Response queryAll() throws Exception {
    HttpStatus status = HttpStatus.OK;
    String response = JSON.toJSONString(courseService.queryAll(), JSONFilter.NULL_UNDERLINE_FILTERS);

    return Response.status(status.value()).entity(response).build();
}

From source file:org.cloudfoundry.test.web.ServiceController.java

@RequestMapping(value = "/beans", method = RequestMethod.GET)
public ResponseEntity<List<String>> getBeanNames() {
    if (serviceHolder.getBeanNames() == null) {
        return new ResponseEntity<List<String>>(HttpStatus.NOT_FOUND);
    }/*www.j  a va2  s . c o  m*/
    List<String> beans = Arrays.asList(serviceHolder.getBeanNames());
    return new ResponseEntity<List<String>>(beans, HttpStatus.OK);
}

From source file:com.ar.dev.tierra.api.controller.NotaCreditoController.java

@RequestMapping(value = "/search/id", method = RequestMethod.GET)
public ResponseEntity<?> getById(@RequestParam("idNota") int idNota) {
    NotaCredito notaCredito = facadeService.getNotaCreditoDAO().getById(idNota);
    if (notaCredito != null) {
        return new ResponseEntity<>(notaCredito, HttpStatus.OK);
    } else {//from  w w  w  .  ja v  a2s  .c  o m
        return new ResponseEntity<>(HttpStatus.NOT_FOUND);
    }
}

From source file:com.cloudbees.jenkins.plugins.demo.actuator.UnsecureSampleActuatorApplicationTests.java

@Test
public void testHome() throws Exception {
    @SuppressWarnings("rawtypes")
    ResponseEntity<Map> entity = new TestRestTemplate().getForEntity("http://localhost:" + this.port,
            Map.class);
    assertEquals(HttpStatus.OK, entity.getStatusCode());
    @SuppressWarnings("unchecked")
    Map<String, Object> body = entity.getBody();
    assertEquals("Hello Phil", body.get("message"));
    assertFalse("Wrong headers: " + entity.getHeaders(), entity.getHeaders().containsKey("Set-Cookie"));
}