Package org.dspace.app.rest.hdlresolver
Class HdlResolverRestController
java.lang.Object
org.dspace.app.rest.hdlresolver.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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionhandleController(jakarta.servlet.http.HttpServletRequest request, String hdlService) listHandles(jakarta.servlet.http.HttpServletRequest request, String prefix) REST GET Method used to list all available handles starting with target prefix.listPrefixes(jakarta.servlet.http.HttpServletRequest request) REST GET Method used to list all available prefixes for handles.protected Stringprotected StringresolveHandle(jakarta.servlet.http.HttpServletRequest request, String hdlService) REST GET Method used to find and retrieve the URL of a target Handle.
-
Constructor Details
-
HdlResolverRestController
public HdlResolverRestController()
-
-
Method Details
-
handleController
@GetMapping(value="**", produces="application/json;charset=UTF-8") public ResponseEntity<String> handleController(jakarta.servlet.http.HttpServletRequest request, @PathVariable String hdlService) -
resolveHandle
public ResponseEntity<String> resolveHandle(jakarta.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 anHttpStatus.BAD_REQUEST400 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
nullwith status 200 -HttpStatus.OKor 400 -HttpStatus.BAD_REQUESTerror
-
listPrefixes
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 ResponseEntity<String> listHandles(jakarta.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_FOUNDis returned. If the requested prefix is blank, then 404 -HttpStatus.BAD_REQUESTis 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-HttpServletRequestprefix-Stringrepresenting the prefix that will be searched- Returns:
- List of valid prefixes with status 200
HttpStatus.OKor status 400HttpStatus.NOT_FOUNDif disabled by properties or status 404HttpStatus.BAD_REQUESTif blank prefix is requested.
-
mapAsJson
-
mapAsJson
-