Class ConfluenceHtmlEntityEncodingPolicy
java.lang.Object
com.atlassian.confluence.velocity.htmlsafe.ConfluenceHtmlEntityEncodingPolicy
- All Implemented Interfaces:
- com.atlassian.velocity.htmlsafe.ReferenceInsertionPolicy
public final class ConfluenceHtmlEntityEncodingPolicy
extends Object
implements com.atlassian.velocity.htmlsafe.ReferenceInsertionPolicy
This reference insertion policy implements the strategy used by Confluence to determine whether automatic HTML
 entity encoding should be applied to any particular context or template used by the Velocity rendering system.
- Since:
- 8.6
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionorg.apache.velocity.app.event.ReferenceInsertionEventHandlergetReferenceInsertionEventHandler(org.apache.velocity.context.Context context) booleanshouldAutoEncode(org.apache.velocity.context.Context context) booleanshouldAutoEncode(org.apache.velocity.context.Context context, @Nullable org.apache.velocity.Template template) Decides whether autoencoding should be enabled for a given context and optional template.
- 
Constructor Details- 
ConfluenceHtmlEntityEncodingPolicypublic ConfluenceHtmlEntityEncodingPolicy()
 
- 
- 
Method Details- 
shouldAutoEncodepublic boolean shouldAutoEncode(org.apache.velocity.context.Context context, @Nullable org.apache.velocity.Template template) Decides whether autoencoding should be enabled for a given context and optional template. We currently autoencode:- if the template is a HtmlSafeVelocityTemplatewithout autoencodeDisabled
- OR if the template is null or otherwise not a HtmlSafeVelocityTemplateand the context _is_ or _wraps anOutputMimeTypeAwareContextwith a mimetype of html
 - Parameters:
- context- a context which will be handled specially if it is an- OutputMimeTypeAwareContextor is an- InternalContextAdaptercontaining an- OutputMimeTypeAwareContext.
- template- a nullable template which will be handled specially if it's a- HtmlSafeVelocityTemplate
- Returns:
- true if autoencoding should be enabled for this context and template.
 
- if the template is a 
- 
shouldAutoEncodepublic boolean shouldAutoEncode(org.apache.velocity.context.Context context) 
- 
getReferenceInsertionEventHandlerpublic org.apache.velocity.app.event.ReferenceInsertionEventHandler getReferenceInsertionEventHandler(org.apache.velocity.context.Context context) - Specified by:
- getReferenceInsertionEventHandlerin interface- com.atlassian.velocity.htmlsafe.ReferenceInsertionPolicy
 
 
-