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:com.ar.dev.tierra.api.controller.TarjetaController.java

@RequestMapping(value = "/list", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> getAll() {
    List<Tarjeta> categorias = facadeService.getTarjetaDAO().getAll();
    if (!categorias.isEmpty()) {
        return new ResponseEntity<>(categorias, HttpStatus.OK);
    } else {//  w  w w  .j a v a  2s  .c om
        return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
    }
}

From source file:com.opensearchserver.hadse.record.RecordController.java

@RequestMapping(method = RequestMethod.PUT, value = "/{index_name}/{id}")
@ResponseBody//from w  w  w  .j a  va 2  s  .  c  o  m
public HttpEntity<String> putData(@RequestBody Map<String, Object> values) {
    return new ResponseEntity<String>("Not yet implemented", HttpStatus.NOT_IMPLEMENTED);
}

From source file:io.pivotal.ecosystem.service.client.HelloClientController.java

@RequestMapping(value = "/greeting", method = RequestMethod.GET, produces = "application/json; charset=UTF-8")
ResponseEntity<String> greeting(@RequestParam(value = "username") String username) {
    try {/*w  w  w.  j  av a2s. c  o  m*/
        return new ResponseEntity<>(helloRepository.greeting(username), HttpStatus.OK);
    } catch (HelloException e) {
        return new ResponseEntity<>(e.getMessage(), e.getStatus());
    }
}

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

/**
 *
 * @return//from  w w w  .  j a  va2  s .  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:com.ar.dev.tierra.api.controller.ChartController.java

@RequestMapping(value = "/vendedor/ventas", method = RequestMethod.GET)
public ResponseEntity<?> getVentaVendedor(@RequestParam("idVendedor") int idVendedor) {
    List<Chart> chart = impl.getDineroVendedores(idVendedor);
    if (!chart.isEmpty()) {
        return new ResponseEntity<>(chart, HttpStatus.OK);
    } else {//from  w  w  w  .java 2s.  c  o m
        return new ResponseEntity<>(HttpStatus.NOT_FOUND);
    }
}

From source file:org.cloudfoundry.identity.uaa.error.ConvertingExceptionViewTests.java

@Test
public void testGetContentType() throws Exception {
    RuntimeException e = new RuntimeException("Unexpected error");
    view = new ConvertingExceptionView(
            new ResponseEntity<ExceptionReport>(new ExceptionReport(e), HttpStatus.INTERNAL_SERVER_ERROR),
            messageConverters);//from  w w w  .j  a  v a2s .  c o  m
    assertEquals("*/*", view.getContentType());
}

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

/**
 *
 * @return/* w  ww.  j a  v  a2s  .com*/
 */
@RequestMapping(value = "/all", method = RequestMethod.GET)
@ResponseBody
public ResponseEntity<List<Subcategorias>> getSubcategorias() {
    List<Subcategorias> u = se.getSubcategorias();
    return new ResponseEntity<>(u, HttpStatus.OK);
}

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

/**
 *
 * @return/*from www . j  av  a2s.  c o m*/
 */
@RequestMapping(value = "/all", method = RequestMethod.GET)
@ResponseBody
public ResponseEntity<List<Presentaciones>> getPresentaciones() {
    List<Presentaciones> u = se.getPresentaciones();
    return new ResponseEntity<>(u, HttpStatus.OK);

}

From source file:net.eusashead.hateoas.response.impl.PutResponseBuilderImpl.java

@Override
public ResponseEntity<Void> build() {
    ResponseEntity<Void> responseEntity;
    if (isCreate) {
        responseEntity = new ResponseEntity<Void>(this.headers, HttpStatus.CREATED);
    } else {//from   w w  w  . j  a  va  2s .c om
        responseEntity = new ResponseEntity<Void>(this.headers, HttpStatus.NO_CONTENT);
    }
    return responseEntity;
}

From source file:com.baidu.stqa.signet.web.action.SubmitAction.java

/**
 * ???/*w w  w  .  ja va  2 s .c om*/
 * 
 * @param projectId
 * @param storyId
 * @return
 */
@RequestMapping(value = "/project/{projectId}/story/{storyId}/submission", method = RequestMethod.GET)
@ResponseBody
public ResponseEntity<Boolean> isSubmit(@PathVariable long projectId, @PathVariable long storyId) {

    doLog(projectId);
    Submit submit = submitService.querySubmit(projectId, storyId);
    if (submit == null) {
        return new ResponseEntity<Boolean>(false, HttpStatus.OK);
    } else {
        return new ResponseEntity<Boolean>(true, HttpStatus.OK);
    }
}