Package org.saidone.controller
Class VaultApiController
java.lang.Object
org.saidone.controller.VaultApiController
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity
<?> archiveNode
(String auth, String nodeId) org.springframework.http.ResponseEntity
<?> org.springframework.http.ResponseEntity
<org.springframework.core.io.InputStreamResource> getNodeContent
(String auth, String nodeId, boolean attachment) org.springframework.http.ResponseEntity
<String> Handles any unexpected exception thrown during request processing.org.springframework.http.ResponseEntity
<String> Handles cases where the requested node cannot be found in the vault.org.springframework.http.ResponseEntity
<String> Handles out-of-memory situations that may occur when streaming large files.org.springframework.http.ResponseEntity
<String> Handles vault specific errors that may occur while processing a request.org.springframework.http.ResponseEntity
<?> restoreNode
(String auth, String nodeId, boolean restorePermissions)
-
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 thrownVaultException
- 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
- theOutOfMemoryError
encountered- Returns:
- a response indicating that the server ran out of memory
-
getNode
-
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
-
archiveNode
-