Class MediaConstraintsException

All Implemented Interfaces:
Serializable

public class MediaConstraintsException extends UploadRejectedException
This Exception will be thrown if a media constraint setting is violated.
Since:
4.1
See Also:
  • Constructor Details

    • MediaConstraintsException

      public MediaConstraintsException(String message)
      Create a new exception instance. This exception indicates a media constraint setting has been violated.
      Parameters:
      message - a meaningful cause why rejecting this upload
      Since:
      4.1
    • MediaConstraintsException

      public MediaConstraintsException(String message, Map<String,String> params)
      Create a new exception instance. This exception indicates a media constraint setting has been violated.
       final Map<String, String> parameter = new HashMap<String, String>(); parameter.put("extension", mimeType.getExtension()); parameter.put("mime_type", mimeType.toString()); parameter.put("allowed_extensions", "jpg,png,gif,bmp"); throw new MediaConstraintsException( "message", parameter ); 
      Parameters:
      message - a meaningful cause why rejecting this upload
      params - a parameter map - see example.
      Since:
      4.1
    • MediaConstraintsException

      public MediaConstraintsException(String message, Map<String,String> params, MediaConstraintsException.EXCEPTION_VARIANT type)
      Create a new exception instance. This exception indicates a media constraint setting has been violated.
       final Map<String, String> parameter = new HashMap<String, String>(); parameter.put("extension", mimeType.getExtension()); parameter.put("mime_type", mimeType.toString()); parameter.put("allowed_extensions", "jpg,png,gif,bmp"); throw new MediaConstraintsException( "message", parameter, de.espirit.firstspirit.store.access.mediastore.MediaConstraintsException.EXCEPTION_VARIANT.MEDIA_EXTENSION_REJECTED ); 
      Parameters:
      message - a meaningful cause why rejecting this upload
      params - a parameter map - see example.
      type - the exception variant type
      Since:
      4.1
  • Method Details

    • getHumanReadableSize

      public static Map<String,String> getHumanReadableSize(Map<String,String> params)
      Returns human readable values.
       final Map<String, String> parameter = new HashMap<String, String>(); parameter.put("extension", mimeType.getExtension()); parameter.put("mime_type", mimeType.toString()); parameter.put("allowed_extensions", "jpg,png,gif,bmp"); throw new MediaConstraintsException( "message", parameter, de.espirit.firstspirit.store.access.mediastore.MediaConstraintsException.EXCEPTION_VARIANT.MEDIA_EXTENSION_REJECTED ); 
      Parameters:
      params - a parameter map - see example.
      Returns:
      the evaluated param map
      Since:
      4.1
    • getExceptionType

      Get the variant type used for computing a generic fallback message.
      Returns:
      the exception variant type
      Since:
      4.1
    • getParams

      public Map<String,String> getParams()
      Return the given parameter map.
       final Map<String, String> parameter = new HashMap<String, String>(); parameter.put("extension", mimeType.getExtension()); parameter.put("mime_type", mimeType.toString()); parameter.put("allowed_extensions", "jpg,png,gif,bmp"); throw new MediaConstraintsException( "message", parameter, de.espirit.firstspirit.store.access.mediastore.MediaConstraintsException.EXCEPTION_VARIANT.MEDIA_EXTENSION_REJECTED ); 
      Returns:
      the parameter map
      Since:
      4.1
    • getMessage

      public String getMessage()
      Overrides:
      getMessage in class Throwable