Class ImageUploadHandler

All Implemented Interfaces:
JcmsConstants, JaliosConstants

public class ImageUploadHandler extends JcmsUploadFormHandler
  • Field Details

    • UPLOAD_IMAGE_URL

      public static final 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:
    • SOURCE_PARAM

      public static final 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:
    • DEFAULT_TITLE_FORMAT

      public static final 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:
    • TITLE_FORMAT

      public static final 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 Details

    • ImageUploadHandler

      public ImageUploadHandler()
  • Method Details

    • processAction

      public boolean processAction() throws 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:
      IOException - IO Exception
    • processStatus

      protected boolean processStatus(ControllerStatus status) throws 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:
      IOException - if an error occurs
    • setFile

      public void setFile(String[] files)
    • getImageInfos

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

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

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