Class ImageUploadHandler

    • Field Detail

      • UPLOAD_IMAGE_URL

        public static final java.lang.String UPLOAD_IMAGE_URL
        Define the URL used to upload an image pasted or drag and dropped in the WYSIWIG editor (cf. configuration-image-handler.conf
        See Also:
        Constant Field Values
      • SOURCE_PARAM

        public static final java.lang.String SOURCE_PARAM
        Request parameter to define the image source (image id). It's retrieved in the image handler plugin to convert the IMG tag to a <jalios:media>
        See Also:
        Constant Field Values
      • DEFAULT_TITLE_FORMAT

        public static final java.lang.String DEFAULT_TITLE_FORMAT
        Default title format used when rewriting FileDocument title upload through wysiwyg editor.
        Since:
        jcms-10.0.2 - JCMS-6562
        See Also:
        Constant Field Values
      • TITLE_FORMAT

        public static final java.text.MessageFormat TITLE_FORMAT
        Message format used to rewrite FileDocument title from "mceclip123" to anything else. When invoked, the following arguments are specified :
        1. original "mceclip123" value (String)
        2. current time (java.util.Date)
        3. current logged member full name (String)
        4. current workspace title (String)
        Default format used is "{0} - {1,date,yyyy-MM-dd HH\'h\'mm\'m\'ss\'s\'}".
        This message format may be overrided with property "wysiwyg.image-upload.title-format"
        Since:
        jcms-10.0.2 - JCMS-6562
    • Constructor Detail

      • ImageUploadHandler

        public ImageUploadHandler()
    • Method Detail

      • processAction

        public boolean processAction()
                              throws java.io.IOException
        Description copied from class: JcmsFormHandler
        Method to be implemented to check/validate action to be performed and process them.

        Default implementation is to return false. No need to call super method.

        This method may NOT be invoked at all if security validation are not met.

        You must ensure your handler and JSP can work properly without any code invoked in this method.

        Overrides:
        processAction in class JcmsFormHandler
        Returns:
        false if no redirection is needed, true otherwise
        Throws:
        java.io.IOException - IO Exception
      • processStatus

        protected boolean processStatus​(ControllerStatus status)
                                 throws java.io.IOException
        Description copied from class: JcmsFormHandler
        Process the ControllerStatus: do nothing if OK, or send on forbidden, or put a warning message in the request.
        Overrides:
        processStatus in class JcmsFormHandler
        Parameters:
        status - the ControllerStatus to be processed
        Returns:
        true when status is OK, false if status was a failure (forbidden or anything else)
        Throws:
        java.io.IOException - if an error occurs
      • setFile

        public void setFile​(java.lang.String[] files)
      • getImageInfos

        public java.lang.String getImageInfos()
        Returns the JSON object that contains a "location" property retrieved by the wyiwyg editor.
        Returns:
        JSON object
      • getErrorMessage

        public java.lang.String getErrorMessage()
        Returns the JSON representation of the response, whether a valid image infor or a generic error message.
        Returns:
        JSON string
      • getJSON

        public java.lang.String getJSON()
        Returns the JSON representation of the response, whether a valid image infor or a generic error message.
        Returns:
        JSON string