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.SexoController.java

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

From source file:sample.mvc.SecurityController.java

@RequestMapping(value = "/principal")
public ResponseEntity<User> currentPrincipal(@CurrentUser User currentUser) {
    return new ResponseEntity<User>(currentUser, HttpStatus.OK);
}

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

@RequestMapping(value = "/list", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> getAll() {
    List<MedioPago> list = facadeService.getMedioPagoDAO().getAll();
    if (!list.isEmpty()) {
        return new ResponseEntity<>(list, HttpStatus.OK);
    } else {//from   www  .  j a v  a2  s .c o m
        return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
    }
}

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

/**
 * ?//from  w  w w. j  av  a  2s .co m
 * 
 * @return
 */
@RequestMapping(value = "/odw", method = RequestMethod.GET)
@ResponseBody
public ResponseEntity<Map<String, Long>> check() {
    Map<String, Long> map = new HashMap<String, Long>();
    map.put("status", 0L);
    return new ResponseEntity<Map<String, Long>>(map, HttpStatus.OK);
}

From source file:com.orange.cloud.servicebroker.filter.core.service.ServiceInstanceBindingServiceProxyTest.java

private static ResponseEntity<CreateServiceInstanceAppBindingResponse> created() {
    return new ResponseEntity<CreateServiceInstanceAppBindingResponse>(
            new CreateServiceInstanceAppBindingResponse(), HttpStatus.CREATED);
}

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

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

From source file:com.melayer.camzia.controller.MeControllerAdmin.java

@RequestMapping(path = "/check", produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.GET)
public Callable<ResponseEntity<Map<String, Object>>> checkWebServices() {

    return () -> {

        entityMap.clear();/*w ww . ja  v  a 2  s.com*/
        entityMap.put("status", "working fine");

        ResponseEntity<Map<String, Object>> entity = new ResponseEntity<>(entityMap, HttpStatus.OK);

        return entity;
    };
}

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

@RequestMapping(method = GET, value = DAY_TYPES)
public ResponseEntity<List<DayType>> dayTypes() {
    return new ResponseEntity<>(asList(DayType.values()), OK);
}

From source file:edu.eci.arsw.blindway.controller.UsuarioController.java

@RequestMapping(value = "/registro", method = RequestMethod.POST)
public ResponseEntity<?> manejadorPostRecursoUsuario(String nombre, int edad, String genero, String nickname,
        String contrasena, String correoElectronico) {
    try {//from w  w  w  . jav a  2s . co  m
        stub.registroUsuario(nombre, edad, genero, nickname, contrasena, correoElectronico);
        return new ResponseEntity<>("El usuario fue creado satisfactoriamente.", HttpStatus.CREATED);
    } catch (RegistroUsuarioException ex) {
        return new ResponseEntity<>(ex.getMessage(), HttpStatus.NOT_ACCEPTABLE);
    }
}

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

@Override
public ResponseEntity<UserProfile> findById(int idUsuario, String token, Long id)
        throws EntidadNoEncontradaException {
    UserProfile p = repoUserProfile.findOne(id);

    if (p != null) {
        return new ResponseEntity(p, HttpStatus.OK);
    } else {/* w w w  .  ja  v a2 s .c  o  m*/
        throw new EntidadNoEncontradaException("Entity User Profile");
    }
}