Class HeaderLinksResponseEntity<T extends RepresentationModel<?>>
java.lang.Object
org.springframework.http.HttpEntity<T>
org.springframework.http.ResponseEntity<T>
org.springframework.hateoas.server.core.HeaderLinksResponseEntity<T>
Special
ResponseEntity that exposes Link instances in the contained RepresentationModel as
link headers instead of in the body. Note, that this class is not intended to be used directly from user code but by
support code that will transparently invoke the header exposure. If you use this class from a controller directly,
the Links will not be present in the RepresentationModel instance anymore when
RepresentationModelProcessors kick in.- Author:
- Oliver Gierke
-
Nested Class Summary
Nested classes/interfaces inherited from class org.springframework.http.ResponseEntity
ResponseEntity.BodyBuilder, ResponseEntity.HeadersBuilder<B extends ResponseEntity.HeadersBuilder<B>> -
Field Summary
Fields inherited from class org.springframework.http.HttpEntity
EMPTY -
Method Summary
Modifier and TypeMethodDescriptionstatic <S extends RepresentationModel<?>>
HeaderLinksResponseEntity<S>wrap(HttpEntity<S> entity) Wraps the givenHttpEntityinto aHeaderLinksResponseEntity.static <S extends RepresentationModel<?>>
HeaderLinksResponseEntity<S>wrap(S entity) Wraps the givenRepresentationModelinto aHeaderLinksResponseEntity.Methods inherited from class org.springframework.http.ResponseEntity
accepted, badRequest, created, equals, getStatusCode, getStatusCodeValue, hashCode, internalServerError, noContent, notFound, of, of, ofNullable, ok, ok, status, status, toString, unprocessableEntityMethods inherited from class org.springframework.http.HttpEntity
getBody, getHeaders, hasBody
-
Method Details
-
wrap
public static <S extends RepresentationModel<?>> HeaderLinksResponseEntity<S> wrap(HttpEntity<S> entity) Wraps the givenHttpEntityinto aHeaderLinksResponseEntity. Will default the status code toHttpStatus.OKif the given value is not aResponseEntity.- Parameters:
entity- must not be null.- Returns:
-
wrap
Wraps the givenRepresentationModelinto aHeaderLinksResponseEntity. Will default the status code toHttpStatus.OK.- Parameters:
entity- must not be null.- Returns:
-