Class RestResourceController

java.lang.Object
org.dspace.app.rest.RestResourceController
All Implemented Interfaces:
InitializingBean

@RestController @RequestMapping("/api/{apiCategory}/{model}") public class RestResourceController extends Object implements InitializingBean
This is the main entry point of the new REST API. Its responsibility is to provide a consistent behaviors for all the exposed resources in terms of returned HTTP codes, endpoint URLs, HTTP verbs to methods translation, etc. It delegates to the repository the business logic
Author:
Andrea Bollini (andrea.bollini at 4science.it)
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    ResponseEntity<org.springframework.hateoas.RepresentationModel<?>>
    action(jakarta.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
     
    ResponseEntity<org.springframework.hateoas.RepresentationModel<?>>
    delete(jakarta.servlet.http.HttpServletRequest request, String apiCategory, String model, Integer id)
    Method to delete an entity by ID Note that the regular expression in the request mapping accept a number as identifier;
    ResponseEntity<org.springframework.hateoas.RepresentationModel<?>>
    delete(jakarta.servlet.http.HttpServletRequest request, String apiCategory, String model, String id)
     
    ResponseEntity<org.springframework.hateoas.RepresentationModel<?>>
    delete(jakarta.servlet.http.HttpServletRequest request, String apiCategory, String model, UUID uuid)
     
    <T extends RestAddressableModel>
    org.springframework.hateoas.RepresentationModel
    executeSearchMethods(String apiCategory, String model, String searchMethodName, jakarta.servlet.http.HttpServletResponse response, org.springframework.data.domain.Pageable pageable, org.springframework.data.domain.Sort sort, org.springframework.data.web.PagedResourcesAssembler assembler, MultiValueMap<String,Object> parameters)
     
    <T extends RestAddressableModel>
    org.springframework.hateoas.PagedModel<DSpaceResource<T>>
    findAll(String apiCategory, String model, org.springframework.data.domain.Pageable page, org.springframework.data.web.PagedResourcesAssembler assembler, jakarta.servlet.http.HttpServletResponse response, MultiValueMap<String,Object> parameters)
    Find all via a GET request to the root endpoint.
    findOne(String apiCategory, String model, Integer id)
    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) for findOne with string as identifier and see findOne(String, String, UUID) for uuid as identifier
    findOne(String apiCategory, String model, String id)
    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://<dspace.server.url>/api/{apiCategory}/{model}/{id} Example:
    findOne(String apiCategory, String model, UUID uuid)
    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) for findOne with number as identifier and see findOne(String, String, String) for string as identifier
    org.springframework.hateoas.RepresentationModel
    findRel(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, String apiCategory, String model, Integer id, String rel, String relid, org.springframework.data.domain.Pageable page, org.springframework.data.web.PagedResourcesAssembler assembler)
     
    org.springframework.hateoas.RepresentationModel
    findRel(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, String apiCategory, String model, Integer id, String rel, org.springframework.data.domain.Pageable page, org.springframework.data.web.PagedResourcesAssembler assembler)
    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.RepresentationModel
    findRel(jakarta.servlet.http.HttpServletRequest request, jakarta.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)
    Called in GET, try to retrieve the requested linked resource.
    org.springframework.hateoas.RepresentationModel
    findRel(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, String apiCategory, String model, String id, String rel, org.springframework.data.domain.Pageable page, org.springframework.data.web.PagedResourcesAssembler assembler)
    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.RepresentationModel
    findRel(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, String apiCategory, String model, UUID uuid, String rel, org.springframework.data.domain.Pageable page, org.springframework.data.web.PagedResourcesAssembler assembler)
    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.RepresentationModel
    listSearchMethods(String apiCategory, String model)
     
    ResponseEntity<org.springframework.hateoas.RepresentationModel<?>>
    patch(jakarta.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;
    ResponseEntity<org.springframework.hateoas.RepresentationModel<?>>
    patch(jakarta.servlet.http.HttpServletRequest request, String apiCategory, String model, String 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;
    ResponseEntity<org.springframework.hateoas.RepresentationModel<?>>
    patch(jakarta.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>
    ResponseEntity<org.springframework.hateoas.RepresentationModel<?>>
    patchInternal(jakarta.servlet.http.HttpServletRequest request, String apiCategory, String model, ID id, com.fasterxml.jackson.databind.JsonNode jsonNode)
    Internal patch method
    ResponseEntity<org.springframework.hateoas.RepresentationModel<?>>
    post(jakarta.servlet.http.HttpServletRequest request, String apiCategory, String model, String parent)
    Execute a POST request; curl -X POST -H "Content-Type:application/json" http://<dspace.server.url>/api/{apiCategory}/{model} Example:
    <ID extends Serializable>
    ResponseEntity<org.springframework.hateoas.RepresentationModel<?>>
    postJsonInternal(jakarta.servlet.http.HttpServletRequest request, String apiCategory, String model, String parent)
    Internal method to execute POST with application/json MediaType;
    <ID extends Serializable>
    ResponseEntity<org.springframework.hateoas.RepresentationModel<?>>
    postUriListInternal(jakarta.servlet.http.HttpServletRequest request, String apiCategory, String model)
    Internal method to execute POST with text/uri-list MediaType;
    ResponseEntity<org.springframework.hateoas.RepresentationModel<?>>
    postWithUriListContentType(jakarta.servlet.http.HttpServletRequest request, String apiCategory, String model)
    Execute a POST request; curl -X POST -H "Content-Type:text/uri-list" http://<dspace.server.url>/api/{apiCategory}/{model} Example:
    put(jakarta.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://<dspace.server.url>/api/{apiCategory}/{model}/{id} Example:
    put(jakarta.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://<dspace.server.url>/api/{apiCategory}/{model}/{id} Example:
    put(jakarta.servlet.http.HttpServletRequest request, String apiCategory, String model, String id, com.fasterxml.jackson.databind.JsonNode jsonNode)
    Execute a PUT request for an entity with id of type String and containing 32 hexadecimal digits.
    put(jakarta.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://<dspace.server.url>/api/{apiCategory}/{model}/{uuid} Example:
    <ID extends Serializable>
    ResponseEntity<org.springframework.hateoas.RepresentationModel<?>>
    upload(jakarta.servlet.http.HttpServletRequest request, String apiCategory, String model, Integer id, 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;
    <ID extends Serializable>
    ResponseEntity<org.springframework.hateoas.RepresentationModel<?>>
    upload(jakarta.servlet.http.HttpServletRequest request, String apiCategory, String model, String id, 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 String as identifier;
    <T extends RestAddressableModel>
    ResponseEntity<org.springframework.hateoas.RepresentationModel<?>>
    upload(jakarta.servlet.http.HttpServletRequest request, String apiCategory, String model, List<MultipartFile> uploadfile)
    Upload a file against the collection resource endpoint.
    <ID extends Serializable>
    ResponseEntity<org.springframework.hateoas.RepresentationModel<?>>
    upload(jakarta.servlet.http.HttpServletRequest request, String apiCategory, String model, UUID uuid, 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;

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait