Class TusResumableValidator
java.lang.Object
me.desair.tus.server.core.validation.TusResumableValidator
- All Implemented Interfaces:
RequestValidator
Class that will validate if the tus version in the request corresponds to our implementation
version
The Tus-Resumable header MUST be included in every request and response except for OPTIONS requests. The value MUST be the version of the protocol used by the Client or the Server. If the the version specified by the Client is not supported by the Server, it MUST respond with the 412 Precondition Failed status and MUST include the Tus-Version header into the response. In addition, the Server MUST NOT process the request.
(https://tus.io/protocols/resumable-upload.html#tus-resumable)
The Tus-Resumable header MUST be included in every request and response except for OPTIONS requests. The value MUST be the version of the protocol used by the Client or the Server. If the the version specified by the Client is not supported by the Server, it MUST respond with the 412 Precondition Failed status and MUST include the Tus-Version header into the response. In addition, the Server MUST NOT process the request.
(https://tus.io/protocols/resumable-upload.html#tus-resumable)
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
supports
(HttpMethod method) Test if this validator supports the given HTTP methodvoid
validate
(HttpMethod method, jakarta.servlet.http.HttpServletRequest request, UploadStorageService uploadStorageService, String ownerKey) Validate if the request should be processed
-
Constructor Details
-
TusResumableValidator
public TusResumableValidator()
-
-
Method Details
-
validate
public void validate(HttpMethod method, jakarta.servlet.http.HttpServletRequest request, UploadStorageService uploadStorageService, String ownerKey) throws TusException Description copied from interface:RequestValidator
Validate if the request should be processed- Specified by:
validate
in interfaceRequestValidator
- Parameters:
method
- The HTTP method of this request (do not useHttpServletRequest.getMethod()
!)request
- TheHttpServletRequest
to validateuploadStorageService
- The current upload storage serviceownerKey
- A key representing the owner of the upload- Throws:
TusException
- When validation fails and the request should not be processed
-
supports
Description copied from interface:RequestValidator
Test if this validator supports the given HTTP method- Specified by:
supports
in interfaceRequestValidator
- Parameters:
method
- The current HTTP method- Returns:
- true if supported, false otherwise
-