Class UploadHandler.UploadConfig

java.lang.Object
com.wontlost.ckeditor.handler.UploadHandler.UploadConfig
Enclosing interface:
UploadHandler

public static class UploadHandler.UploadConfig extends Object
Upload configuration
  • Field Details

    • MIN_FILE_SIZE

      public static final long MIN_FILE_SIZE
      Minimum allowed file size: 1 byte
      See Also:
    • MAX_FILE_SIZE_LIMIT

      public static final long MAX_FILE_SIZE_LIMIT
      Maximum allowed file size: 1GB
      See Also:
    • DEFAULT_MAX_FILE_SIZE

      public static final long DEFAULT_MAX_FILE_SIZE
      Default maximum file size: 10MB
      See Also:
  • Constructor Details

    • UploadConfig

      public UploadConfig()
  • Method Details

    • getMaxFileSize

      public long getMaxFileSize()
      Get maximum file size
      Returns:
      maximum file size in bytes
    • setMaxFileSize

      public UploadHandler.UploadConfig setMaxFileSize(long maxFileSize)
      Set maximum file size
      Parameters:
      maxFileSize - maximum file size in bytes, must be between 1 byte and 1GB
      Returns:
      this
      Throws:
      IllegalArgumentException - if maxFileSize is outside the valid range
    • getAllowedMimeTypes

      public String[] getAllowedMimeTypes()
      Get allowed MIME types
      Returns:
      a copy of the MIME types array
    • setAllowedMimeTypes

      public UploadHandler.UploadConfig setAllowedMimeTypes(String... allowedMimeTypes)
      Set allowed MIME types. Setting to an empty array allows all MIME types.
      Parameters:
      allowedMimeTypes - MIME types array
      Returns:
      this
      Throws:
      IllegalArgumentException - if the array is null or contains null/empty strings
    • addAllowedMimeTypes

      public UploadHandler.UploadConfig addAllowedMimeTypes(String... mimeTypes)
      Add additional MIME types to the allowed list
      Parameters:
      mimeTypes - MIME types to add
      Returns:
      this
    • resetAllowedMimeTypes

      public UploadHandler.UploadConfig resetAllowedMimeTypes()
      Reset to the default MIME types list
      Returns:
      this
    • validate

      public String validate(UploadHandler.UploadContext context)
      Validate an upload against this configuration
      Parameters:
      context - upload context
      Returns:
      error message if validation fails, null if validation passes