Package com.jalios.jcms.wysiwyg
Class WysiwygMediasRewriter
- java.lang.Object
- 
- com.jalios.jcms.wysiwyg.WysiwygMediasRewriter
 
- 
 public class WysiwygMediasRewriter extends java.lang.ObjectProvides facilities to rewrite object tag in HTML wysiwyg content with content generated by the MediaTag and its template API.html = WysiwygMediasRewriter.rewriteMedias(html) It is invoked automatically byWysiwygRendererthrough <jalios:wysiwyg> tag, if the following property was defined :wysiwyg.medias-rewrite.enabled: true - Since:
- jcms-7.1.3 jcms-8.0.2 JCMS-3680
 
- 
- 
Constructor SummaryConstructors Constructor Description WysiwygMediasRewriter()
 - 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static booleancanRewrite()Check if the current context information required to rewrite a media are available.static java.util.Set<FileDocument>extractMedias(java.lang.String html)Find all the "object" tags in the specified html and extract the corresponding FileDocument.static java.lang.StringrenderMedia(java.lang.String mediaSource, int maxWidth, int maxHeight)Render the specified media path using the appropriate MediaTag template .static java.lang.StringrewriteMedias(java.lang.String html)Find all the "object" tags in the specified html and replace them with a rendering performed by the MediaTag.
 
- 
- 
- 
Method Detail- 
rewriteMediaspublic static java.lang.String rewriteMedias(java.lang.String html) Find all the "object" tags in the specified html and replace them with a rendering performed by the MediaTag.- Parameters:
- html- the HTML fragment to be modified
- Returns:
- the modified HTML never return null
 
 - 
extractMediaspublic static java.util.Set<FileDocument> extractMedias(java.lang.String html) Find all the "object" tags in the specified html and extract the corresponding FileDocument.- Parameters:
- html- the HTML fragment to be modified
- Returns:
- a set of FileDocument, never return null
- Since:
- JCMS-6258
 
 - 
canRewritepublic static boolean canRewrite() Check if the current context information required to rewrite a media are available.Depending on the implementation (Tomcat or JspEngine), the requirements may not be the same (current request available, ...). - Returns:
- true if rewrite can be performed, false otherwise
 
 - 
renderMediapublic static java.lang.String renderMedia(java.lang.String mediaSource, int maxWidth, int maxHeight)Render the specified media path using the appropriate MediaTag template .- Parameters:
- mediaSource- the source of the media : an id, an URL, or a path relative to the webapp
- maxWidth- a maximum width, value is ignored if equals or lower than 0
- maxHeight- a maximum height, value is ignored if equals or lower than 0
- Returns:
- null if media could not be rendered, otherwise the rendering of the JSP
 
 
- 
 
-