Example usage for org.springframework.http ResponseEntity ResponseEntity

List of usage examples for org.springframework.http ResponseEntity ResponseEntity

Introduction

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

Prototype

public ResponseEntity(MultiValueMap<String, String> headers, HttpStatus status) 

Source Link

Document

Create a new HttpEntity with the given headers and status code, and no body.

Usage

From source file:cloud.simple.web.UserController.java

@RequestMapping(value = "/users")
public ResponseEntity<List<User>> readUserInfo() {
    List<User> users = userService.readUserInfo();
    return new ResponseEntity<List<User>>(users, HttpStatus.OK);
}

From source file:monkeys.web.BananasController.java

@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody//from w w  w.ja v a  2  s  .com
public ResponseEntity<Void> createBanana(@RequestBody Banana banana) {
    bananaRepository.save(banana);
    HttpHeaders headers = new HttpHeaders();
    return new ResponseEntity<>(headers, HttpStatus.CREATED);
}

From source file:br.com.authentication.business.handler.GlobalRestExceptionHandler.java

@ExceptionHandler(Exception.class)
@ResponseBody/*from   w w w. j av a 2  s . com*/
public ResponseEntity<Object> handleException(Exception e) {
    LOGGER.info("handleException {} {}", e.getClass(), e.getMessage());
    return new ResponseEntity<Object>(e.getMessage(), HttpStatus.NOT_FOUND);
}

From source file:com.dhenton9000.birt.controllers.support.ExceptionControllerAdvice.java

@ExceptionHandler(Exception.class)
public ResponseEntity<GenericError> handleException(Exception e) {

    GenericError ge = new GenericError(e);
    return new ResponseEntity<GenericError>(ge, HttpStatus.INTERNAL_SERVER_ERROR);
}

From source file:com.diagrama.repository.EncuestControl.java

@RequestMapping(value = "/taller/{idproducto}", method = RequestMethod.GET)
public ResponseEntity<?> getEncuesta(@PathVariable int idproducto) {
    Iterable<Producto> producto = er.findAll();
    return new ResponseEntity<>(producto, HttpStatus.OK);
}

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   ww  w. j  a v  a  2s. c om
}

From source file:br.com.oauth.resources.HomeRestController.java

@RequestMapping(method = RequestMethod.GET)
public ResponseEntity<Resposta<String>> getHome() {
    Resposta<String> resposta = RespostaBuilder.getBuilder().setResultado("Est  a home e voc esta logado")
            .build();/* w ww .  j a  v a 2  s .  com*/
    return new ResponseEntity<>(resposta, HttpStatus.OK);
}

From source file:fi.helsinki.opintoni.web.rest.AbstractResource.java

protected final <T> ResponseEntity<T> response(T result) {
    return new ResponseEntity<>(result, HttpStatus.OK);
}

From source file:be.boyenvaesen.RestControllers.HumidityRestController.java

@RequestMapping("/humidity/minute")
@ResponseBody//from   w w w.  ja v  a 2 s.  c om
public ResponseEntity<List<HumidityByMinute>> getByMinute() {

    return new ResponseEntity<>(
            service.getBetweenDatesByInterval(HumidityByMinute.class, new Date(1476391394000L), new Date()),
            HttpStatus.OK);

}

From source file:fi.hsl.parkandride.front.SchemaController.java

@RequestMapping(method = GET, value = USAGES)
public ResponseEntity<List<Usage>> usages() {
    return new ResponseEntity<>(asList(Usage.values()), OK);
}