Class ControllerUtils

java.lang.Object
org.springframework.data.rest.webmvc.ControllerUtils

public class ControllerUtils extends Object
Author:
Oliver Gierke, Greg Turnquist
  • Constructor Details

    • ControllerUtils

      public ControllerUtils()
  • Method Details

    • toResponseEntity

      public static <R extends org.springframework.hateoas.RepresentationModel<?>> ResponseEntity<org.springframework.hateoas.RepresentationModel<?>> toResponseEntity(HttpStatus status, HttpHeaders headers, Optional<R> resource)
    • toResponseEntity

      public static <R extends org.springframework.hateoas.RepresentationModel<?>> ResponseEntity<org.springframework.hateoas.RepresentationModel<?>> toResponseEntity(HttpStatus status, HttpHeaders headers, R resource)
      Wrap a resource as a ResponseEntity and attach given headers and status.
      Type Parameters:
      R -
      Parameters:
      status -
      headers -
      resource -
      Returns:
    • toEmptyResponse

      public static ResponseEntity<org.springframework.hateoas.RepresentationModel<?>> toEmptyResponse(HttpStatus status)
      Return an empty response that is only comprised of a status
      Parameters:
      status -
      Returns:
    • toEmptyResponse

      public static ResponseEntity<org.springframework.hateoas.RepresentationModel<?>> toEmptyResponse(HttpStatus status, HttpHeaders headers)
      Return an empty response that is only comprised of headers and a status
      Parameters:
      status -
      headers -
      Returns: