Class VaultApiController

java.lang.Object
org.saidone.controller.VaultApiController

@RestController @RequestMapping("/api/vault") public class VaultApiController extends Object
REST controller that exposes operations for interacting with the vault.

All endpoints require basic authentication and delegate the heavy lifting to VaultService and ContentService.

  • Constructor Details

    • VaultApiController

      public VaultApiController()
  • Method Details

    • handleException

      @ExceptionHandler(java.lang.Exception.class) public org.springframework.http.ResponseEntity<String> handleException(Exception e)
      Handles any unexpected exception thrown during request processing.
      Parameters:
      e - the exception that was raised
      Returns:
      a generic 500 Internal Server Error response
    • handleVaultException

      @ExceptionHandler(VaultException.class) public org.springframework.http.ResponseEntity<String> handleVaultException(Exception e)
      Handles vault specific errors that may occur while processing a request.
      Parameters:
      e - the thrown VaultException
      Returns:
      a generic error response with HTTP status 500
    • handleNodeNotFoundException

      @ExceptionHandler(NodeNotFoundException.class) public org.springframework.http.ResponseEntity<String> handleNodeNotFoundException(NodeNotFoundException e)
      Handles cases where the requested node cannot be found in the vault.
      Parameters:
      e - the thrown exception
      Returns:
      a response with HTTP status 404 Not Found
    • handleOutOfMemoryError

      @ExceptionHandler(java.lang.OutOfMemoryError.class) public org.springframework.http.ResponseEntity<String> handleOutOfMemoryError(OutOfMemoryError e)
      Handles out-of-memory situations that may occur when streaming large files.
      Parameters:
      e - the OutOfMemoryError encountered
      Returns:
      a response indicating that the server ran out of memory
    • getNode

      @GetMapping("/nodes/{nodeId}") public org.springframework.http.ResponseEntity<?> getNode(@RequestHeader(value="Authorization",required=false) String auth, @PathVariable String nodeId)
    • getNodeContent

      @GetMapping("/nodes/{nodeId}/content") public org.springframework.http.ResponseEntity<org.springframework.core.io.InputStreamResource> getNodeContent(@RequestHeader(value="Authorization",required=false) String auth, @PathVariable String nodeId, @RequestParam(required=false,defaultValue="true") boolean attachment)
    • restoreNode

      @PostMapping("/nodes/{nodeId}/restore") public org.springframework.http.ResponseEntity<?> restoreNode(@RequestHeader(value="Authorization",required=false) String auth, @PathVariable String nodeId, @RequestParam(required=false,defaultValue="false") boolean restorePermissions)
    • archiveNode

      @PostMapping("/nodes/{nodeId}/archive") public org.springframework.http.ResponseEntity<?> archiveNode(@RequestHeader(value="Authorization",required=false) String auth, @PathVariable String nodeId)