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.api.Responses.java

public static <T> ResponseEntity<T> ok(T model) {
    return new ResponseEntity<T>(model, HttpStatus.OK);
}

From source file:org.ff4j.spring.boot.utilts.FeatureWebUtils.java

public static ResponseEntity<Boolean> getBooleanResponseEntityByHttpStatus(FeatureActions featureActions) {
    switch (featureActions) {
    case CREATED:
        return new ResponseEntity<>(TRUE, HttpStatus.CREATED);
    case UPDATED:
        return new ResponseEntity<>(TRUE, HttpStatus.ACCEPTED);
    default://  w  w  w  .ja v a2s  .co  m
        return new ResponseEntity<>(FALSE, HttpStatus.NO_CONTENT);
    }
}

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

public static ResponseEntity<VndErrors> notFound(String logref) {
    return new ResponseEntity<>(new VndErrors(logref, "Resource not found"), HttpStatus.NOT_FOUND);
}

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

public static <T> ResponseEntity<T> ok(T body) {
    return new ResponseEntity<>(body, HttpStatus.OK);
}

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

public static ResponseEntity<Void> created(Link location) {
    HttpHeaders headers = new HttpHeaders();
    headers.add("Location", location.getHref());
    return new ResponseEntity<>(headers, HttpStatus.CREATED);
}

From source file:rest.TestRestController.java

@RequestMapping(value = "/echo/{input}", method = RequestMethod.GET)
public ResponseEntity<?> consultaX(@PathVariable String input) {
    return new ResponseEntity<>("REST API working. Echo:" + input, HttpStatus.ACCEPTED);
}

From source file:be.boyenvaesen.RestControllers.HumidityRestController.java

@RequestMapping("/humidity")
@ResponseBody//  w  w w  . j a  v a2s .co  m
public ResponseEntity<List<Humidity>> getAll() {
    return new ResponseEntity<>(service.getAll(), HttpStatus.OK);

}

From source file:com.sms.server.controller.SettingsController.java

@RequestMapping(value = "/version", method = RequestMethod.GET)
public ResponseEntity<String> getVersion() {
    return new ResponseEntity<>(SettingsService.getVersion().toString(), HttpStatus.OK);
}

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

@RequestMapping(method = GET, value = CAPACITY_TYPES)
public ResponseEntity<List<CapacityType>> capacityTypes() {
    return new ResponseEntity<>(asList(CapacityType.values()), OK);
}

From source file:monkeys.web.MonkeysController.java

@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody//ww w .j  a v a 2s.c  o m
public ResponseEntity<Void> createMonkey(@RequestBody Monkey monkey) {
    monkeyRepository.save(monkey);
    HttpHeaders headers = new HttpHeaders();
    return new ResponseEntity<>(headers, HttpStatus.CREATED);
}