@RestController
@RequestMapping(value="/api/{apiCategory}/{model}")
public class RestResourceController
extends Object
implements org.springframework.beans.factory.InitializingBean
| Constructor and Description |
|---|
RestResourceController() |
| Modifier and Type | Method and Description |
|---|---|
org.springframework.http.ResponseEntity<org.springframework.hateoas.ResourceSupport> |
action(javax.servlet.http.HttpServletRequest request,
String apiCategory,
String model,
Integer id)
Called in POST, with a x-www-form-urlencoded, execute an action on a resource
Note that the regular expression in the request mapping accept a number as identifier;
|
void |
afterPropertiesSet() |
org.springframework.http.ResponseEntity<org.springframework.hateoas.ResourceSupport> |
delete(javax.servlet.http.HttpServletRequest request,
String apiCategory,
String model,
Integer id) |
org.springframework.http.ResponseEntity<org.springframework.hateoas.ResourceSupport> |
delete(javax.servlet.http.HttpServletRequest request,
String apiCategory,
String model,
UUID uuid) |
<T extends RestAddressableModel> |
executeSearchMethods(String apiCategory,
String model,
String searchMethodName,
javax.servlet.http.HttpServletResponse response,
org.springframework.data.domain.Pageable pageable,
org.springframework.data.domain.Sort sort,
org.springframework.data.web.PagedResourcesAssembler assembler,
org.springframework.util.MultiValueMap<String,Object> parameters) |
<T extends RestAddressableModel> |
findAll(String apiCategory,
String model,
org.springframework.data.domain.Pageable page,
org.springframework.data.web.PagedResourcesAssembler assembler,
String projection,
javax.servlet.http.HttpServletResponse response)
Find all
|
DSpaceResource<RestAddressableModel> |
findOne(String apiCategory,
String model,
Integer id,
String projection)
Called in GET is used to retrieve the single resource by identifier;
Note that the regular expression in the request mapping accept a number as identifier;
Please see
findOne(String, String, String, String) for findOne with string as
identifier
and see findOne(String, String, UUID, String) for uuid as identifier |
DSpaceResource<RestAddressableModel> |
findOne(String apiCategory,
String model,
String id,
String projection)
Called in GET is used to retrieve the single resource by identifier;
Note that the regular expression in the request mapping accept a string as identifier but not the other kind
of identifier;
http://
|
DSpaceResource<RestAddressableModel> |
findOne(String apiCategory,
String model,
UUID uuid,
String projection)
Called in GET is used to retrieve the single resource by identifier;
Note that the regular expression in the request mapping accept a UUID as identifier;
Please see
findOne(String, String, Integer, String) for findOne with number as
identifier
and see findOne(String, String, String, String) for string as identifier |
org.springframework.hateoas.ResourceSupport |
findRel(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
String apiCategory,
String model,
Integer id,
String rel,
org.springframework.data.domain.Pageable page,
org.springframework.data.web.PagedResourcesAssembler assembler,
String projection)
Called in GET is used to retrieve the relation resources;
Note that the regular expression in the request mapping accept a number;
|
org.springframework.hateoas.ResourceSupport |
findRel(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
String apiCategory,
String model,
String id,
String rel,
org.springframework.data.domain.Pageable page,
org.springframework.data.web.PagedResourcesAssembler assembler,
String projection)
Called in GET is used to retrieve the relation resources;
Note that the regular expression in the request mapping accept a string as identifier but not the other kind
of identifier;
|
org.springframework.hateoas.ResourceSupport |
findRel(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
String apiCategory,
String model,
String id,
String rel,
String relid,
org.springframework.data.domain.Pageable page,
org.springframework.data.web.PagedResourcesAssembler assembler,
String projection)
Called in GET, try to retrieve the requested linked resource.
|
org.springframework.hateoas.ResourceSupport |
findRel(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
String apiCategory,
String model,
UUID uuid,
String rel,
org.springframework.data.domain.Pageable page,
org.springframework.data.web.PagedResourcesAssembler assembler,
String projection)
Called in GET is used to retrieve the relation resources;
Note that the regular expression in the request mapping accept a UUID as identifier;
|
org.springframework.hateoas.ResourceSupport |
listSearchMethods(String apiCategory,
String model) |
org.springframework.http.ResponseEntity<org.springframework.hateoas.ResourceSupport> |
patch(javax.servlet.http.HttpServletRequest request,
String apiCategory,
String model,
Integer id,
com.fasterxml.jackson.databind.JsonNode jsonNode)
PATCH method, using operation on the resources following (JSON) Patch notation (https://tools.ietf
.org/html/rfc6902)
Note that the regular expression in the request mapping accept a number as identifier;
|
org.springframework.http.ResponseEntity<org.springframework.hateoas.ResourceSupport> |
patch(javax.servlet.http.HttpServletRequest request,
String apiCategory,
String model,
UUID id,
com.fasterxml.jackson.databind.JsonNode jsonNode)
PATCH method, using operation on the resources following (JSON) Patch notation (https://tools.ietf
.org/html/rfc6902)
Note that the regular expression in the request mapping accept a UUID as identifier;
|
<ID extends Serializable> |
patchInternal(javax.servlet.http.HttpServletRequest request,
String apiCategory,
String model,
ID id,
com.fasterxml.jackson.databind.JsonNode jsonNode)
Internal patch method
|
org.springframework.http.ResponseEntity<org.springframework.hateoas.ResourceSupport> |
post(javax.servlet.http.HttpServletRequest request,
String apiCategory,
String model)
Execute a POST request;
curl -X POST -H "Content-Type:application/json" http://
|
<ID extends Serializable> |
postJsonInternal(javax.servlet.http.HttpServletRequest request,
String apiCategory,
String model)
Internal method to execute POST with application/json MediaType;
|
<ID extends Serializable> |
postUriListInternal(javax.servlet.http.HttpServletRequest request,
String apiCategory,
String model)
Internal method to execute POST with text/uri-list MediaType;
|
org.springframework.http.ResponseEntity<org.springframework.hateoas.ResourceSupport> |
postWithUriListContentType(javax.servlet.http.HttpServletRequest request,
String apiCategory,
String model)
Execute a POST request;
curl -X POST -H "Content-Type:text/uri-list" http://
|
DSpaceResource<RestAddressableModel> |
put(javax.servlet.http.HttpServletRequest request,
String apiCategory,
String model,
Integer id)
Execute a PUT request for an entity with id of type Integer;
curl -X PUT -H "Content-Type:text/uri-list" http://
|
DSpaceResource<RestAddressableModel> |
put(javax.servlet.http.HttpServletRequest request,
String apiCategory,
String model,
Integer id,
com.fasterxml.jackson.databind.JsonNode jsonNode)
Execute a PUT request for an entity with id of type Integer;
curl -X PUT -H "Content-Type:application/json" http://
|
DSpaceResource<RestAddressableModel> |
put(javax.servlet.http.HttpServletRequest request,
String apiCategory,
String model,
UUID uuid,
com.fasterxml.jackson.databind.JsonNode jsonNode)
Execute a PUT request for an entity with id of type UUID;
curl -X PUT http://
|
<ID extends Serializable> |
upload(javax.servlet.http.HttpServletRequest request,
String apiCategory,
String model,
Integer id,
org.springframework.web.multipart.MultipartFile uploadfile)
Called in POST, multipart, upload to a specific rest resource the file passed as "file" request parameter
Note that the regular expression in the request mapping accept a number as identifier;
|
<T extends RestAddressableModel> |
upload(javax.servlet.http.HttpServletRequest request,
String apiCategory,
String model,
org.springframework.web.multipart.MultipartFile uploadfile)
Upload a file against the collection resource endpoint.
|
<ID extends Serializable> |
upload(javax.servlet.http.HttpServletRequest request,
String apiCategory,
String model,
UUID id,
org.springframework.web.multipart.MultipartFile uploadfile)
Called in POST, multipart, upload to a specific rest resource the file passed as "file" request parameter
Note that the regular expression in the request mapping accept a UUID as identifier;
|
public void afterPropertiesSet()
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean@RequestMapping(method=GET,
value="/{id:\\d+}")
public DSpaceResource<RestAddressableModel> findOne(@PathVariable
String apiCategory,
@PathVariable
String model,
@PathVariable
Integer id,
@RequestParam(required=false)
String projection)
findOne(String, String, String, String) for findOne with string as
identifier
and see findOne(String, String, UUID, String) for uuid as identifierapiCategory - model - id - projection - @RequestMapping(method=GET,
value="/{id:^(?!^\\d+$)(?!^[0-9a-fxA-FX]{8}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{12}$)[\\w+\\-]+$+}")
public DSpaceResource<RestAddressableModel> findOne(@PathVariable
String apiCategory,
@PathVariable
String model,
@PathVariable
String id,
@RequestParam(required=false)
String projection)
http://<dspace.url>/dspace-spring-rest/api/config/submissionsections/collection
Please see findOne(String, String, Integer, String) for findOne with number as
identifier
and see findOne(String, String, UUID, String) for uuid as identifierapiCategory - model - id - projection - @RequestMapping(method=GET,
value="/{uuid:[0-9a-fxA-FX]{8}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{12}}")
public DSpaceResource<RestAddressableModel> findOne(@PathVariable
String apiCategory,
@PathVariable
String model,
@PathVariable
UUID uuid,
@RequestParam(required=false)
String projection)
findOne(String, String, Integer, String) for findOne with number as
identifier
and see findOne(String, String, String, String) for string as identifierapiCategory - model - uuid - projection - @RequestMapping(method=GET,
value="/{id:\\d+}/{rel}")
public org.springframework.hateoas.ResourceSupport findRel(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
@PathVariable
String apiCategory,
@PathVariable
String model,
@PathVariable
Integer id,
@PathVariable
String rel,
org.springframework.data.domain.Pageable page,
org.springframework.data.web.PagedResourcesAssembler assembler,
@RequestParam(required=false)
String projection)
request - apiCategory - model - id - rel - page - assembler - projection - @RequestMapping(method=GET,
value="/{id:^(?!^\\d+$)(?!^[0-9a-fxA-FX]{8}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{12}$)[\\w+\\-]+$+}/{rel}")
public org.springframework.hateoas.ResourceSupport findRel(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
@PathVariable
String apiCategory,
@PathVariable
String model,
@PathVariable
String id,
@PathVariable
String rel,
org.springframework.data.domain.Pageable page,
org.springframework.data.web.PagedResourcesAssembler assembler,
@RequestParam(required=false)
String projection)
request - apiCategory - model - id - rel - page - assembler - projection - @RequestMapping(method=GET,
value="/{uuid:[0-9a-fxA-FX]{8}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{12}}/{rel}")
public org.springframework.hateoas.ResourceSupport findRel(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
@PathVariable
String apiCategory,
@PathVariable
String model,
@PathVariable
UUID uuid,
@PathVariable
String rel,
org.springframework.data.domain.Pageable page,
org.springframework.data.web.PagedResourcesAssembler assembler,
@RequestParam(required=false)
String projection)
request - apiCategory - model - uuid - rel - page - assembler - projection - @RequestMapping(method=GET,
value="/{id:^(?!^\\d+$)(?!^[0-9a-fxA-FX]{8}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{12}$)[\\w+\\-]+$+}/{rel}/{relid:[\\w+\\-]+}")
public org.springframework.hateoas.ResourceSupport findRel(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
@PathVariable
String apiCategory,
@PathVariable
String model,
@PathVariable
String id,
@PathVariable
String rel,
@PathVariable
String relid,
org.springframework.data.domain.Pageable page,
org.springframework.data.web.PagedResourcesAssembler assembler,
@RequestParam(required=false)
String projection)
http://<dspace.url>/dspace-spring-rest/api/integration/authorities/SRJournalTitle/entryValues/1479-9995
Example:
http://<dspace.url>/dspace-spring-rest/api/integration/authorities/srsc/entries/VR110111
request - apiCategory - model - id - rel - relid - page - assembler - projection - @RequestMapping(method=POST,
consumes={"application/json","application/hal+json"})
public org.springframework.http.ResponseEntity<org.springframework.hateoas.ResourceSupport> post(javax.servlet.http.HttpServletRequest request,
@PathVariable
String apiCategory,
@PathVariable
String model)
throws org.springframework.web.HttpRequestMethodNotSupportedException
curl -X POST -H "Content-Type:application/json" http://<dspace.url>/dspace-spring-rest/api/submission/workspaceitems
request - The relevant requestapiCategory - The apiCategory to be usedmodel - The model to be usedorg.springframework.web.HttpRequestMethodNotSupportedException - If something goes wrong@RequestMapping(method=POST,
consumes="text/uri-list")
public org.springframework.http.ResponseEntity<org.springframework.hateoas.ResourceSupport> postWithUriListContentType(javax.servlet.http.HttpServletRequest request,
@PathVariable
String apiCategory,
@PathVariable
String model)
throws org.springframework.web.HttpRequestMethodNotSupportedException
curl -X POST -H "Content-Type:text/uri-list" http://<dspace.url>/dspace-spring-rest/api/submission/workspaceitems
request - The relevant requestapiCategory - The apiCategory to be usedmodel - The model to be usedorg.springframework.web.HttpRequestMethodNotSupportedException - If something goes wrongpublic <ID extends Serializable> org.springframework.http.ResponseEntity<org.springframework.hateoas.ResourceSupport> postJsonInternal(javax.servlet.http.HttpServletRequest request, String apiCategory, String model) throws org.springframework.web.HttpRequestMethodNotSupportedException
request - The relevant requestapiCategory - The apiCategory to be usedmodel - The model to be usedorg.springframework.web.HttpRequestMethodNotSupportedException - If something goes wrongpublic <ID extends Serializable> org.springframework.http.ResponseEntity<org.springframework.hateoas.ResourceSupport> postUriListInternal(javax.servlet.http.HttpServletRequest request, String apiCategory, String model) throws org.springframework.web.HttpRequestMethodNotSupportedException
request - The relevant requestapiCategory - The apiCategory to be usedmodel - The model to be usedorg.springframework.web.HttpRequestMethodNotSupportedException - If something goes wrong@RequestMapping(method=POST,
value="/{id:\\d+}",
headers="content-type=application/x-www-form-urlencoded")
public org.springframework.http.ResponseEntity<org.springframework.hateoas.ResourceSupport> action(javax.servlet.http.HttpServletRequest request,
@PathVariable
String apiCategory,
@PathVariable
String model,
@PathVariable
Integer id)
throws org.springframework.web.HttpRequestMethodNotSupportedException,
SQLException,
IOException
request - apiCategory - model - id - org.springframework.web.HttpRequestMethodNotSupportedExceptionIOExceptionSQLException@RequestMapping(method=POST,
value="/{id:\\d+}",
headers="content-type=multipart/form-data")
public <ID extends Serializable> org.springframework.http.ResponseEntity<org.springframework.hateoas.ResourceSupport> upload(javax.servlet.http.HttpServletRequest request,
@PathVariable
String apiCategory,
@PathVariable
String model,
@PathVariable
Integer id,
@RequestParam(value="file")
org.springframework.web.multipart.MultipartFile uploadfile)
throws org.springframework.web.HttpRequestMethodNotSupportedException
request - the http requestapiCategory - the api categorymodel - the rest model that identify the REST resource collectionid - the id of the specific rest resourceuploadfile - the file to uploadorg.springframework.web.HttpRequestMethodNotSupportedException@RequestMapping(method=POST,
value="/{uuid:[0-9a-fxA-FX]{8}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{12}}",
headers="content-type=multipart/form-data")
public <ID extends Serializable> org.springframework.http.ResponseEntity<org.springframework.hateoas.ResourceSupport> upload(javax.servlet.http.HttpServletRequest request,
@PathVariable
String apiCategory,
@PathVariable
String model,
@PathVariable
UUID id,
@RequestParam(value="file")
org.springframework.web.multipart.MultipartFile uploadfile)
throws org.springframework.web.HttpRequestMethodNotSupportedException
request - the http requestapiCategory - the api categorymodel - the rest model that identify the REST resource collectionid - the id of the specific rest resourceuploadfile - the file to uploadorg.springframework.web.HttpRequestMethodNotSupportedException@RequestMapping(method=POST,
headers="content-type=multipart/form-data")
public <T extends RestAddressableModel> org.springframework.http.ResponseEntity<org.springframework.hateoas.ResourceSupport> upload(javax.servlet.http.HttpServletRequest request,
@PathVariable
String apiCategory,
@PathVariable
String model,
@RequestParam(value="file")
org.springframework.web.multipart.MultipartFile uploadfile)
throws SQLException,
FileNotFoundException,
IOException,
AuthorizeException
request - the http requestapiCategory - the api categorymodel - the rest model that identify the REST resource collectionuploadfile - the bulk fileSQLExceptionFileNotFoundExceptionIOExceptionAuthorizeException@RequestMapping(method=PATCH,
value="/{id:\\d+}")
public org.springframework.http.ResponseEntity<org.springframework.hateoas.ResourceSupport> patch(javax.servlet.http.HttpServletRequest request,
@PathVariable
String apiCategory,
@PathVariable
String model,
@PathVariable
Integer id,
@RequestBody(required=true)
com.fasterxml.jackson.databind.JsonNode jsonNode)
throws org.springframework.web.HttpRequestMethodNotSupportedException
request - apiCategory - model - id - jsonNode - org.springframework.web.HttpRequestMethodNotSupportedException@RequestMapping(method=PATCH,
value="/{uuid:[0-9a-fxA-FX]{8}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{12}}")
public org.springframework.http.ResponseEntity<org.springframework.hateoas.ResourceSupport> patch(javax.servlet.http.HttpServletRequest request,
@PathVariable
String apiCategory,
@PathVariable
String model,
@PathVariable(name="uuid")
UUID id,
@RequestBody(required=true)
com.fasterxml.jackson.databind.JsonNode jsonNode)
throws org.springframework.web.HttpRequestMethodNotSupportedException
request - apiCategory - model - id - jsonNode - org.springframework.web.HttpRequestMethodNotSupportedExceptionpublic <ID extends Serializable> org.springframework.http.ResponseEntity<org.springframework.hateoas.ResourceSupport> patchInternal(javax.servlet.http.HttpServletRequest request, String apiCategory, String model, ID id, com.fasterxml.jackson.databind.JsonNode jsonNode) throws org.springframework.web.HttpRequestMethodNotSupportedException
request - apiCategory - model - id - jsonNode - org.springframework.web.HttpRequestMethodNotSupportedException@RequestMapping(method=GET) public <T extends RestAddressableModel> org.springframework.hateoas.PagedResources<DSpaceResource<T>> findAll(@PathVariable String apiCategory, @PathVariable String model, org.springframework.data.domain.Pageable page, org.springframework.data.web.PagedResourcesAssembler assembler, @RequestParam(required=false) String projection, javax.servlet.http.HttpServletResponse response)
apiCategory - model - page - assembler - projection - @RequestMapping(method=GET,
value="/search")
public org.springframework.hateoas.ResourceSupport listSearchMethods(@PathVariable
String apiCategory,
@PathVariable
String model)
@RequestMapping(method=GET,
value="/search/{searchMethodName}")
public <T extends RestAddressableModel> org.springframework.hateoas.ResourceSupport executeSearchMethods(@PathVariable
String apiCategory,
@PathVariable
String model,
@PathVariable
String searchMethodName,
javax.servlet.http.HttpServletResponse response,
org.springframework.data.domain.Pageable pageable,
org.springframework.data.domain.Sort sort,
org.springframework.data.web.PagedResourcesAssembler assembler,
@RequestParam
org.springframework.util.MultiValueMap<String,Object> parameters)
throws IllegalAccessException,
IllegalArgumentException,
InvocationTargetException
@RequestMapping(method=DELETE,
value="/{id:\\d+}")
public org.springframework.http.ResponseEntity<org.springframework.hateoas.ResourceSupport> delete(javax.servlet.http.HttpServletRequest request,
@PathVariable
String apiCategory,
@PathVariable
String model,
@PathVariable
Integer id)
throws org.springframework.web.HttpRequestMethodNotSupportedException
org.springframework.web.HttpRequestMethodNotSupportedException@RequestMapping(method=DELETE,
value="/{uuid:[0-9a-fxA-FX]{8}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{12}}")
public org.springframework.http.ResponseEntity<org.springframework.hateoas.ResourceSupport> delete(javax.servlet.http.HttpServletRequest request,
@PathVariable
String apiCategory,
@PathVariable
String model,
@PathVariable
UUID uuid)
throws org.springframework.web.HttpRequestMethodNotSupportedException
org.springframework.web.HttpRequestMethodNotSupportedException@RequestMapping(method=PUT,
value="/{uuid:[0-9a-fxA-FX]{8}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{12}}")
public DSpaceResource<RestAddressableModel> put(javax.servlet.http.HttpServletRequest request,
@PathVariable
String apiCategory,
@PathVariable
String model,
@PathVariable
UUID uuid,
@RequestBody
com.fasterxml.jackson.databind.JsonNode jsonNode)
curl -X PUT http://<dspace.restUrl>/api/core/collection/8b632938-77c2-487c-81f0-e804f63e68e6
request - the http requestapiCategory - the API category e.g. "core"model - the DSpace model e.g. "collection"uuid - the ID of the target REST objectjsonNode - the part of the request body representing the updated rest object@RequestMapping(method=PUT,
value="/{id:\\d+}",
consumes={"application/json","application/hal+json"})
public DSpaceResource<RestAddressableModel> put(javax.servlet.http.HttpServletRequest request,
@PathVariable
String apiCategory,
@PathVariable
String model,
@PathVariable
Integer id,
@RequestBody(required=true)
com.fasterxml.jackson.databind.JsonNode jsonNode)
curl -X PUT -H "Content-Type:application/json" http://<dspace.url>/dspace-spring-rest/api/core/metadatafield/1
request - the http requestapiCategory - the API category e.g. "api"model - the DSpace model e.g. "collection"id - the ID of the target REST objectjsonNode - the part of the request body representing the updated rest object@RequestMapping(method=PUT,
value="/{id:\\d+}",
consumes="text/uri-list")
public DSpaceResource<RestAddressableModel> put(javax.servlet.http.HttpServletRequest request,
@PathVariable
String apiCategory,
@PathVariable
String model,
@PathVariable
Integer id)
throws IOException
curl -X PUT -H "Content-Type:text/uri-list" http://<dspace.url>/dspace-spring-rest/api/core/metadatafield/1
request - the http requestapiCategory - the API category e.g. "api"model - the DSpace model e.g. "collection"id - the ID of the target REST objectIOExceptionCopyright © 2019 DuraSpace. All rights reserved.