Package org.exoplatform.upload
Interface UploadFileValidator
- All Known Implementing Classes:
SvgUploadValidator
public interface UploadFileValidator
Validates uploaded files without altering their content.
Implementations must be selective in supports(String, String) so the
centralized upload service does not inspect large unrelated files such as
Office documents, PDFs, archives, videos, etc.
-
Method Summary
-
Method Details
-
supports
- Parameters:
fileName- uploaded file namemimeType- detected or enriched MIME type- Returns:
- true only when this validator must inspect the uploaded file
-
validate
void validate(String fileName, String mimeType, InputStream inputStream) throws org.apache.commons.fileupload2.core.FileUploadException Validates the uploaded file in read-only mode.The provided
InputStreamis owned by the caller. Implementations must read from it but must not close it.The stream is expected to be positioned at the beginning of the uploaded content. When several validators support the same file, the caller should provide a fresh stream to each validator.
- Parameters:
fileName- uploaded file namemimeType- detected or enriched MIME typeinputStream- upload fileInputStream- Throws:
org.apache.commons.fileupload2.core.FileUploadException- when the upload must be rejected
-