Interface MediaTemplatePolicyFilter

All Superinterfaces:
Comparable, PluginComponent, PolicyFilter
All Known Implementing Classes:
BasicMediaTemplatePolicyFilter

public interface MediaTemplatePolicyFilter extends PolicyFilter
This interface provides hooks around Media rendering.
Since:
jcms-9.0.5
Author:
Sylvain Devaux
  • Method Details

    • getMediaTemplatePath

      String getMediaTemplatePath(String mediaTemplatePath, String templateName, String mediaPath, String mediaContentType)
      Retrieve the path of the JSP suitable to display the specified media.

      FileDocument can be retrieved with mediaPath using:

       FileDocument fileDocument = FileDocument.getFileDocumentFromFilename(mediaPath);
       
      Parameters:
      mediaTemplatePath - proposed media template path (or path already overrided by other MediaTemplatePolicyFilter)
      templateName - the name of the template to retrieve
      mediaPath - the path of the media to display, relative to the webapp root (eg. upload/docs/myfile.ext) can also be an URL such as https://www.youtube.com/watch?v=abc (if supported in template declarations)
      mediaContentType - the content type of the media to display (eg. image/jpeg)
      Returns:
      the relative path of the Media JSP template to use to display the specified media, may return null if no suitable template was find for the media
    • getMediaTemplatePath

      String getMediaTemplatePath(String mediaTemplatePath, String templateName, Data data)
      Retrieve the path of the JSP suitable to display the specified Data.
      Parameters:
      mediaTemplatePath - proposed media template path (or path already overrided by other MediaTemplatePolicyFilter)
      templateName - the name of the template to retrieve
      data - the Data to display
      Returns:
      the relative path of the Media JSP template to use to display the specified Data