public class ReadOnlyApiController<T extends Model<ID>,ID extends Serializable> extends AbstractApiController<T,ID>
AbstractApiController that
throws a MethodNotAllowedException when
POST, PUT, or DELETE operations are attempted.| Constructor and Description |
|---|
ReadOnlyApiController(RepositoryOperations<T,ID> repository,
Class<T> model,
org.springframework.hateoas.mvc.ResourceAssemblerSupport<T,FilterableResource> assembler) |
| Modifier and Type | Method and Description |
|---|---|
org.springframework.http.HttpEntity<?> |
create(T entity,
javax.servlet.http.HttpServletRequest request)
POST /
Attempts to create a new record using the submitted entity. |
org.springframework.http.HttpEntity<?> |
delete(ID id,
javax.servlet.http.HttpServletRequest request)
DELETE /{id}
Attempts to delete the an entity identified by the submitted primary ID. |
org.springframework.http.HttpEntity<?> |
update(T entity,
ID id,
javax.servlet.http.HttpServletRequest request)
PUT /{id}
Attempts to update an existing entity record, replacing it with the submitted entity. |
find, findById, findDistinct, getAssembler, getModel, getRepository, head, options, setApplicationContextpublic ReadOnlyApiController(RepositoryOperations<T,ID> repository, Class<T> model, org.springframework.hateoas.mvc.ResourceAssemblerSupport<T,FilterableResource> assembler)
@RequestMapping(value="",
method=POST,
produces={"application/json","application/hal+json","application/hal+xml","application/xml","text/plain"})
public org.springframework.http.HttpEntity<?> create(@RequestBody
T entity,
javax.servlet.http.HttpServletRequest request)
POST /
Attempts to create a new record using the submitted entity. Throws an exception if the
entity already exists.@RequestMapping(value="/{id}",
method=PUT,
produces={"application/json","application/hal+json","application/hal+xml","application/xml","text/plain"})
public org.springframework.http.HttpEntity<?> update(@RequestBody
T entity,
@PathVariable
ID id,
javax.servlet.http.HttpServletRequest request)
PUT /{id}
Attempts to update an existing entity record, replacing it with the submitted entity. Throws
an exception if the target entity does not exist.@RequestMapping(value="/{id}",
method=DELETE)
public org.springframework.http.HttpEntity<?> delete(@PathVariable
ID id,
javax.servlet.http.HttpServletRequest request)
DELETE /{id}
Attempts to delete the an entity identified by the submitted primary ID.HttpStatus indicating success or failure.Copyright © 2016. All rights reserved.