@RepositoryRestController public class RepositoryController extends Object
| Constructor and Description |
|---|
RepositoryController(PagedResourcesAssembler<Object> assembler,
Repositories repositories,
org.springframework.hateoas.EntityLinks entityLinks,
ResourceMappings mappings)
Creates a new
RepositoryController for the given PagedResourcesAssembler, Repositories,
EntityLinks and ResourceMappings. |
| Modifier and Type | Method and Description |
|---|---|
protected <T extends Throwable> |
badRequest(HttpHeaders headers,
T throwable) |
protected <T extends Throwable> |
badRequest(T throwable) |
protected org.springframework.hateoas.Resources<org.springframework.hateoas.Resource<Object>> |
entitiesToResources(Iterable<Object> entities,
PersistentEntityResourceAssembler assembler) |
protected org.springframework.hateoas.Resources<? extends org.springframework.hateoas.Resource<Object>> |
entitiesToResources(Page<Object> page,
PersistentEntityResourceAssembler assembler,
org.springframework.hateoas.Link baseLink) |
<T extends Throwable> |
errorResponse(HttpHeaders headers,
T throwable,
HttpStatus status) |
<T extends Throwable> |
errorResponse(T throwable,
HttpStatus status) |
ResponseEntity<Void> |
handle(HttpRequestMethodNotSupportedException o_O)
|
ResponseEntity |
handleConflict(Exception ex)
Send a 409 Conflict in case of concurrent modification.
|
ResponseEntity |
handleMiscFailures(Throwable t)
Handle failures commonly thrown from code tries to read incoming data and convert or cast it to the right type.
|
ResponseEntity<?> |
handleNotFound() |
ResponseEntity<ExceptionMessage> |
handleNotReadable(HttpMessageNotReadableException e) |
ResponseEntity<?> |
handleNPE(NullPointerException npe) |
ResponseEntity |
handleRepositoryConstraintViolationException(Locale locale,
RepositoryConstraintViolationException rcve) |
ResponseEntity<?> |
headForRepositories()
HEAD / |
HttpEntity<RepositoryLinksResource> |
listRepositories()
Lists all repositories exported by creating a link list pointing to resources exposing the repositories.
|
protected <T> ResponseEntity<T> |
notFound() |
protected <T> ResponseEntity<T> |
notFound(HttpHeaders headers,
T body) |
HttpEntity<?> |
optionsForRepositories()
OPTIONS /. |
protected org.springframework.hateoas.Link |
resourceLink(RootResourceInformation resourceLink,
org.springframework.hateoas.Resource resource) |
<T> ResponseEntity<T> |
response(HttpHeaders headers,
T body,
HttpStatus status) |
protected org.springframework.hateoas.Resources |
resultToResources(Object result,
PersistentEntityResourceAssembler assembler,
org.springframework.hateoas.Link baseLink) |
void |
setMessageSource(MessageSource messageSource) |
@Autowired public RepositoryController(PagedResourcesAssembler<Object> assembler, Repositories repositories, org.springframework.hateoas.EntityLinks entityLinks, ResourceMappings mappings)
RepositoryController for the given PagedResourcesAssembler, Repositories,
EntityLinks and ResourceMappings.assembler - must not be null.repositories - must not be null.entityLinks - must not be null.mappings - must not be null.@RequestMapping(value="/", method=OPTIONS) public HttpEntity<?> optionsForRepositories()
OPTIONS /.@RequestMapping(value="/", method=HEAD) public ResponseEntity<?> headForRepositories()
HEAD /@RequestMapping(value="/", method=GET) public HttpEntity<RepositoryLinksResource> listRepositories()
public void setMessageSource(MessageSource messageSource)
setMessageSource in interface MessageSourceAware@ExceptionHandler(value=java.lang.NullPointerException.class) @ResponseBody public ResponseEntity<?> handleNPE(NullPointerException npe)
@ExceptionHandler(value=ResourceNotFoundException.class) @ResponseBody public ResponseEntity<?> handleNotFound()
@ExceptionHandler(value=org.springframework.http.converter.HttpMessageNotReadableException.class) @ResponseBody public ResponseEntity<ExceptionMessage> handleNotReadable(HttpMessageNotReadableException e)
@ExceptionHandler(value={java.lang.reflect.InvocationTargetException.class,java.lang.IllegalArgumentException.class,java.lang.ClassCastException.class,org.springframework.core.convert.ConversionFailedException.class}) @ResponseBody public ResponseEntity handleMiscFailures(Throwable t)
t - @ExceptionHandler(value=org.springframework.data.rest.core.RepositoryConstraintViolationException.class) @ResponseBody public ResponseEntity handleRepositoryConstraintViolationException(Locale locale, RepositoryConstraintViolationException rcve)
@ExceptionHandler(value={org.springframework.dao.OptimisticLockingFailureException.class,org.springframework.dao.DataIntegrityViolationException.class}) @ResponseBody public ResponseEntity handleConflict(Exception ex)
ex - @ExceptionHandler @ResponseBody public ResponseEntity<Void> handle(HttpRequestMethodNotSupportedException o_O)
o_O - protected <T> ResponseEntity<T> notFound()
protected <T> ResponseEntity<T> notFound(HttpHeaders headers, T body)
protected <T extends Throwable> ResponseEntity<ExceptionMessage> badRequest(T throwable)
protected <T extends Throwable> ResponseEntity<ExceptionMessage> badRequest(HttpHeaders headers, T throwable)
public <T extends Throwable> ResponseEntity<ExceptionMessage> errorResponse(T throwable, HttpStatus status)
public <T extends Throwable> ResponseEntity<ExceptionMessage> errorResponse(HttpHeaders headers, T throwable, HttpStatus status)
public <T> ResponseEntity<T> response(HttpHeaders headers, T body, HttpStatus status)
protected org.springframework.hateoas.Link resourceLink(RootResourceInformation resourceLink, org.springframework.hateoas.Resource resource)
protected org.springframework.hateoas.Resources resultToResources(Object result, PersistentEntityResourceAssembler assembler, org.springframework.hateoas.Link baseLink)
protected org.springframework.hateoas.Resources<? extends org.springframework.hateoas.Resource<Object>> entitiesToResources(Page<Object> page, PersistentEntityResourceAssembler assembler, org.springframework.hateoas.Link baseLink)
protected org.springframework.hateoas.Resources<org.springframework.hateoas.Resource<Object>> entitiesToResources(Iterable<Object> entities, PersistentEntityResourceAssembler assembler)
Copyright © 2011-2014–2015 Pivotal Software, Inc.. All rights reserved.