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