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:fr.xebia.xke.metrics.web.HealthCheckController.java

@RequestMapping(value = "healthcheck", method = RequestMethod.GET, produces = "text/plain")
public ResponseEntity<String> runChecks() {

    boolean healthy = true;
    StringBuilder sb = new StringBuilder();

    // TODO Exercise 11 - run checks here and build response String

    return new ResponseEntity<String>(sb.toString(), HttpStatus.OK);
}

From source file:org.trustedanalytics.metricsprovider.integrationtests.utils.TestListenableFuture.java

@Override
public void addCallback(ListenableFutureCallback<? super ResponseEntity<T>> listenableFutureCallback) {

    listenableFutureCallback.onSuccess(new ResponseEntity<>(objectToReturn, HttpStatus.OK));
}

From source file:cr.ac.siua.tec.controllers.FormController.java

/**
 * In charge of receiving web requests (forms) and validating them.
 *///from ww  w. j  av a  2s  .  c  o m
@CrossOrigin(origins = "http://tec.siua.ac.cr")
@RequestMapping(value = "/request", method = RequestMethod.POST)
public ResponseEntity<HashMap<String, String>> createTicket(@RequestBody HashMap<String, String> map) {
    HashMap<String, String> responseMap;
    // Verifies recaptcha response with GoogleService.
    if (!recaptchaService.isResponseValid("", map.get("g-recaptcha-response"))) {
        responseMap = (HashMap<String, String>) NotificationManager.getInvalidCaptchaMsg();
    } else {
        responseMap = getRequestResponseMap(map);
    }
    return new ResponseEntity<>(responseMap, HttpStatus.OK);
}

From source file:gt.dakaik.rest.impl.LicenceImpl.java

@Override
public ResponseEntity<Licences> findById(int idUsuario, String token, Long id)
        throws EntidadNoEncontradaException {
    Licences p = repoLic.findOne(id);//  ww  w  .  j  a  va 2s  . c  o m

    if (p != null) {
        return new ResponseEntity(p, HttpStatus.OK);
    } else {
        throw new EntidadNoEncontradaException("Entity User");
    }
}

From source file:com.tribuo.backend.controllers.ProductosController.java

/**
 *
 * @return//from w w  w  . j  a v  a 2 s.c o  m
 */
@RequestMapping(value = "/all", method = RequestMethod.GET)
@ResponseBody
public ResponseEntity<List<Productos>> getProductos() {
    List<Productos> u = se.getProductos();
    return new ResponseEntity<>(u, HttpStatus.OK);
}

From source file:com.tribuo.backend.controllers.CategoriasController.java

/**
 *
 * @return/*from w w  w .j  ava2s.  c  o  m*/
 */
@RequestMapping(value = "/all", method = RequestMethod.GET)
@ResponseBody
public ResponseEntity<List<Categorias>> getCategorias() {
    List<Categorias> u = se.getCategorias();
    return new ResponseEntity<>(u, HttpStatus.OK);
}

From source file:com._8x8.presentation.restfulController.ZPayRestfulController.java

@RequestMapping(value = "/broadcastMsgByQRCode/{qrCode}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<String> broadcastMsgByQRCode(@PathVariable("qrCode") String qrCode) {

    try {//  w ww  . j  a v  a2 s .co  m
        Boolean broadcast = _broadcastService.SendBroadcastMsg("SomeMessage", qrCode);
        return new ResponseEntity<String>(broadcast.toString(), HttpStatus.OK);
    } catch (Exception ex) {
        return new ResponseEntity<String>(HttpStatus.BAD_REQUEST);
    }

}

From source file:com.tribuo.backend.controllers.SucursalesController.java

/**
 *
 * @return//w ww .  j a  v  a 2  s. co  m
 */
@RequestMapping(value = "/all", method = RequestMethod.GET)
@ResponseBody
public ResponseEntity<List<Sucursales>> getSucursales() {
    List<Sucursales> u = se.getSucursales();
    return new ResponseEntity<>(u, HttpStatus.OK);
}

From source file:org.jtwig.acceptance.functions.RenderTest.java

@RequestMapping("/test")
public ResponseEntity<String> test() {
    return new ResponseEntity<>("k", HttpStatus.OK);
}

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

@RequestMapping(value = "/list", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> getAll() {
    List<Marcas> marcas = facadeService.getMarcasDAO().getAll();
    if (!marcas.isEmpty()) {
        return new ResponseEntity<>(marcas, HttpStatus.OK);
    } else {/*from   w  w  w.  ja v a  2  s. c o  m*/
        return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
    }
}