Class ControllerUtils
java.lang.Object
org.springframework.data.rest.webmvc.ControllerUtils
- Author:
- Oliver Gierke, Greg Turnquist
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ResponseEntity<RepresentationModel<?>>toEmptyResponse(HttpStatus status) Return an empty response that is only comprised of a statusstatic ResponseEntity<RepresentationModel<?>>toEmptyResponse(HttpStatus status, HttpHeaders headers) Return an empty response that is only comprised of headers and a statusstatic <R extends RepresentationModel<?>>
ResponseEntity<RepresentationModel<?>>toResponseEntity(HttpStatus status, HttpHeaders headers, Optional<R> resource) static <R extends RepresentationModel<?>>
ResponseEntity<RepresentationModel<?>>toResponseEntity(HttpStatus status, HttpHeaders headers, R resource) Wrap a resource as aResponseEntityand attach given headers and status.
-
Constructor Details
-
ControllerUtils
public ControllerUtils()
-
-
Method Details
-
toResponseEntity
public static <R extends RepresentationModel<?>> ResponseEntity<RepresentationModel<?>> toResponseEntity(HttpStatus status, HttpHeaders headers, Optional<R> resource) -
toResponseEntity
public static <R extends RepresentationModel<?>> ResponseEntity<RepresentationModel<?>> toResponseEntity(HttpStatus status, HttpHeaders headers, R resource) Wrap a resource as aResponseEntityand attach given headers and status.- Type Parameters:
R-- Parameters:
status-headers-resource-- Returns:
-
toEmptyResponse
Return an empty response that is only comprised of a status- Parameters:
status-- Returns:
-
toEmptyResponse
public static ResponseEntity<RepresentationModel<?>> toEmptyResponse(HttpStatus status, HttpHeaders headers) Return an empty response that is only comprised of headers and a status- Parameters:
status-headers-- Returns:
-