Class HdlResolverRestController


  • @RestController
    @ConditionalOnProperty("handle.remote-resolver.enabled")
    @RequestMapping(path="/{hdlService:hdlresolver|resolve|listhandles|listprefixes}/")
    public class HdlResolverRestController
    extends Object
    This controller is public and is useful for handle resolving, whether a target handle identifier will be resolved into the corresponding URL (if found), otherwise will respond a null string.
    Author:
    Vincenzo Mecca (vins01-4science - vincenzo.mecca at 4science.it)
    • Constructor Detail

      • HdlResolverRestController

        public HdlResolverRestController()
    • Method Detail

      • handleController

        @GetMapping(value="**",
                    produces="application/json;charset=UTF-8")
        public org.springframework.http.ResponseEntity<String> handleController​(javax.servlet.http.HttpServletRequest request,
                                                                                @PathVariable
                                                                                String hdlService)
      • resolveHandle

        public org.springframework.http.ResponseEntity<String> resolveHandle​(javax.servlet.http.HttpServletRequest request,
                                                                             String hdlService)
        REST GET Method used to find and retrieve the URL of a target Handle. It should return only one item, if found, else a null body value.
        Generate an HttpStatus.BAD_REQUEST 400 Error if the handle used in path isn't valid.
        The response type will be (application/json;charset=UTF-8) a string representing an array-like list of handles:
        Example:
        • Request: GET - http://{dspace.url}/hdlresolver/handleIdExample/1
        • Response: 200 - ["http://localhost/handle/hanldeIdExample1"]
        Parameters:
        request - HttpServletRequest
        Returns:
        One element List or null with status 200 - HttpStatus.OK or 400 - HttpStatus.BAD_REQUEST error
      • listPrefixes

        public org.springframework.http.ResponseEntity<String> listPrefixes​(javax.servlet.http.HttpServletRequest request)
        REST GET Method used to list all available prefixes for handles. It should return a list of prefixes, at least the default one.
        The response type will be (application/json;charset=UTF-8) a string representing an array-like list of handles:
        Example:
        • Request: GET - http://{dspace.url}/listprefixes
        • Response: 200 - ["123456789","prefix1","prefix2"]
        Parameters:
        request - HttpServletRequest
        Returns:
        List of valid prefixes with status 200 HttpStatus.OK
      • listHandles

        public org.springframework.http.ResponseEntity<String> listHandles​(javax.servlet.http.HttpServletRequest request,
                                                                           @PathVariable
                                                                           String prefix)
        REST GET Method used to list all available handles starting with target prefix. It should return a list of handles.
        If the controller is disabled `handle.hide.listhandles = true`, then 400 - HttpStatus.NOT_FOUND is returned.
        If the requested prefix is blank, then 404 - HttpStatus.BAD_REQUEST is returned.
        The response type will be (application/json;charset=UTF-8) a string representing an array-like list of handles:
        Example:
        • Request: GET - http://{dspace.url}/listhandles/prefix
        • Response: 200 - ["prefix/zero","prefix1/one","prefix2/two"]
        Parameters:
        request - HttpServletRequest
        prefix - String representing the prefix that will be searched
        Returns:
        List of valid prefixes with status 200 HttpStatus.OK or status 400 HttpStatus.NOT_FOUND if disabled by properties or status 404 HttpStatus.BAD_REQUEST if blank prefix is requested.
      • mapAsJson

        protected String mapAsJson​(String resolvedUrl)