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 Link
s will not be present in the RepresentationModel
instance anymore when
RepresentationModelProcessor
s 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 givenHttpEntity
into aHeaderLinksResponseEntity
.static <S extends RepresentationModel<?>>
HeaderLinksResponseEntity<S>wrap
(S entity) Wraps the givenRepresentationModel
into 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, unprocessableEntity
Methods 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 givenHttpEntity
into aHeaderLinksResponseEntity
. Will default the status code toHttpStatus.OK
if the given value is not aResponseEntity
.- Parameters:
entity
- must not be null.- Returns:
-
wrap
Wraps the givenRepresentationModel
into aHeaderLinksResponseEntity
. Will default the status code toHttpStatus.OK
.- Parameters:
entity
- must not be null.- Returns:
-