Class ControllerUtils

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

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

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    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
    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
    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)
     
    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 a ResponseEntity and attach given headers and status.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 a ResponseEntity 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: