Spring Hateoas

org.springframework.hateoas.mvc
Class HeaderLinksResponseEntity<T extends ResourceSupport>

java.lang.Object
  extended by org.springframework.http.HttpEntity<T>
      extended by org.springframework.http.ResponseEntity<T>
          extended by org.springframework.hateoas.mvc.HeaderLinksResponseEntity<T>

public class HeaderLinksResponseEntity<T extends ResourceSupport>
extends ResponseEntity<T>

Special ResponseEntity that exposes Link instances in the contained ResourceSupport 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 ResourceSupport instance anymore when ResourceProcessors kick in.

Author:
Oliver Gierke

Field Summary
 
Fields inherited from class org.springframework.http.HttpEntity
EMPTY
 
Method Summary
static
<S extends ResourceSupport>
HeaderLinksResponseEntity<S>
wrap(HttpEntity<S> entity)
          Wraps the given HttpEntity into a HeaderLinksResponseEntity.
 
Methods inherited from class org.springframework.http.ResponseEntity
equals, getStatusCode, hashCode, toString
 
Methods inherited from class org.springframework.http.HttpEntity
getBody, getHeaders, hasBody
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

wrap

public static <S extends ResourceSupport> HeaderLinksResponseEntity<S> wrap(HttpEntity<S> entity)
Wraps the given HttpEntity into a HeaderLinksResponseEntity. Will default the status code to HttpStatus.OK if the given value is not a ResponseEntity.

Parameters:
entity - must not be null.
Returns:

Spring Hateoas

Copyright © 2012-2014–2014 Pivotal, Inc.. All rights reserved.