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(HttpStatus status) 

Source Link

Document

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

Usage

From source file:com.api.Responses.java

public static ResponseEntity ok() {
    return new ResponseEntity(HttpStatus.OK);
}

From source file:com.api.Responses.java

public static ResponseEntity notFound() {
    return new ResponseEntity(HttpStatus.NOT_FOUND);
}

From source file:hr.softwarecity.osijek.controllers.SessionController.java

/**
 * Method to send error if session is not present
 * @return HTTP 401/*from   w  w w. j  a  v  a 2 s .  c  om*/
 */
@RequestMapping(value = "/badrequest")
public ResponseEntity returnUnauthorized() {
    return new ResponseEntity(HttpStatus.UNAUTHORIZED);
}

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

@ExceptionHandler(ResourceNotFoundException.class)
public ResponseEntity<Exception> handleNoResultException(NoResultException nre) {

    return new ResponseEntity<Exception>(HttpStatus.NOT_FOUND);
}

From source file:com.carlomicieli.jtrains.infrastructure.web.Responses.java

public static ResponseEntity<Void> noContent() {
    return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}

From source file:hr.softwarecity.osijek.controllers.SessionController.java

/**
 * Method to send HTTP ok if session is present
 * @return HTTP 200//from   w w  w  .  j a  v a  2  s . co  m
 */
@RequestMapping(value = "/goodrequest")
public ResponseEntity returnOk() {
    return new ResponseEntity(HttpStatus.OK);
}

From source file:edu.eci.cosw.controllers.ProductsController.java

@RequestMapping(value = "/regifamilia", method = RequestMethod.POST)
public ResponseEntity<?> adicionarFamilia(@RequestBody Familia familia) {
    services.addFamilia(familia);/*  w ww.  j  av  a 2 s.co  m*/
    return new ResponseEntity<>(HttpStatus.ACCEPTED);
}

From source file:br.com.avelar.bac.controllers.CarController.java

@CrossOrigin
@RequestMapping("/license/{license}")
public ResponseEntity<Car> findByLicense(@PathVariable String license) {
    Car Car = service.findOne(license);//from  w  w  w  .  ja  v a 2s.  c  o  m

    if (Car == null) {
        return new ResponseEntity<Car>(HttpStatus.NOT_FOUND);
    }

    return new ResponseEntity<Car>(Car, HttpStatus.OK);

}

From source file:rest.UsuarioRestController.java

@RequestMapping(value = "/usuarios/", method = RequestMethod.GET)
public ResponseEntity<List<UsuarioBean>> listAll() {
    List<UsuarioBean> usuarios = usuarioService.findAll();
    if (usuarios.isEmpty()) {
        return new ResponseEntity<List<UsuarioBean>>(HttpStatus.NO_CONTENT);
    }/*from   w w  w  .j  a v a 2  s  .c  om*/
    return new ResponseEntity<List<UsuarioBean>>(usuarios, HttpStatus.OK);
}

From source file:rest.RondaRestController.java

@RequestMapping(value = "/", method = RequestMethod.POST)
public ResponseEntity<?> guardarJugador(@RequestBody Ronda r) {
    LogicaRonda.registrarRonda(r);//www.ja  v a  2 s .c  o m
    return new ResponseEntity<>(HttpStatus.CREATED);
}