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.tribuo.backend.controllers.EspecificosController.java

/**
 *
 * @param id//  w  w  w . j ava  2  s. c om
 * @return
 */
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public ResponseEntity<Especificos> getSubcategoria(@PathVariable("id") Integer id) {
    Especificos u = se.getEspecificosById(id);
    return new ResponseEntity<>(u, HttpStatus.OK);
}

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

@RequestMapping(method = GET, value = SERVICES)
public ResponseEntity<List<Service>> services() {
    return new ResponseEntity<>(asList(Service.values()), OK);
}

From source file:net.eusashead.hateoas.hal.http.converter.module.impl.ManualAdapterController.java

@ResponseBody
@RequestMapping(value = "/responseentity")
public ResponseEntity<Foo> responseEntity() {
    return new ResponseEntity<Foo>(new Foo(), HttpStatus.OK);
}

From source file:net.paulgray.lmsrest.grades.GradesController.java

@RequestMapping(value = GradesController.PATH, method = RequestMethod.GET, produces = "application/json")
public ResponseEntity getAnnouncements(@ContextUser User user,
        @RequestParam(value = "courseFilter", defaultValue = "") String courseFilter) {
    return new ResponseEntity(gradesService.getGradesForUser(user, courseFilter), HttpStatus.OK);
}

From source file:net.eusashead.hateoas.hal.http.converter.module.impl.AnnotationAdapterController.java

@ResponseBody
@RequestMapping(value = "/responseentity")
public ResponseEntity<Bar> responseEntity() {
    return new ResponseEntity<Bar>(new Bar(), HttpStatus.OK);
}

From source file:com.nazara.proxy.api.Endpoint.java

@RequestMapping(path = "/status", method = RequestMethod.GET)
@ResponseBody//from   www. j a v a  2 s .  co m
public ResponseEntity<Object> proxyRequest(@RequestParam(value = "msisdn", required = false) String msisdn) {
    logger.info("status request arrived");
    try {
        HttpResponse<IPInfo> ipInfoResponse = Unirest.get("http://ipinfo.io/")
                .header("accept", "application/json").asObject(IPInfo.class);
        if (ipInfoResponse.getStatus() == 200) {
            return new ResponseEntity<Object>(ipInfoResponse.getBody(), HttpStatus.OK);
        }
    } catch (Exception exception) {
        logger.error("Error while processing proxy request {}", exception);
        return new ResponseEntity<Object>("NOK|ERR_CODE", HttpStatus.INTERNAL_SERVER_ERROR);
    }
    return new ResponseEntity<Object>("NOK|ERR_CODE", HttpStatus.NO_CONTENT);
}

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

@Override
public ResponseEntity<City> findAll(int idUsuario, String token) throws EntidadNoEncontradaException {
    return new ResponseEntity(repoCity.findAll(), HttpStatus.OK);
}

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

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

    if (p != null) {
        return new ResponseEntity(p, HttpStatus.OK);
    } else {//from www. java2 s . c o m
        throw new EntidadNoEncontradaException("Entity User");
    }
}

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

@RequestMapping(value = "/periodo", method = RequestMethod.GET)
public ResponseEntity<?> ConsultarPeriodo() {
    Iterable<PeriodosLectivos> periodosLectivos = periodoRepository.findAll();
    return new ResponseEntity<>(periodosLectivos, HttpStatus.OK);
}

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

@Override
public ResponseEntity<State> findAll(int idUsuario, String token) throws EntidadNoEncontradaException {
    return new ResponseEntity(repoState.findAll(), HttpStatus.OK);
}