Class ConfluenceHtmlEntityEncodingPolicy
- java.lang.Object
-
- com.atlassian.confluence.util.velocity.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.
-
-
Constructor Summary
Constructors Constructor Description ConfluenceHtmlEntityEncodingPolicy(TemplateHtmlEntityEncodingPolicy templateEncodingPolicy)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.velocity.app.event.ReferenceInsertionEventHandler
getReferenceInsertionEventHandler(org.apache.velocity.context.Context context)
boolean
shouldAutoEncode(org.apache.velocity.context.Context context)
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.
-
-
-
Constructor Detail
-
ConfluenceHtmlEntityEncodingPolicy
public ConfluenceHtmlEntityEncodingPolicy(TemplateHtmlEntityEncodingPolicy templateEncodingPolicy)
-
-
Method Detail
-
shouldAutoEncode
public 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
ConfluenceVelocityTemplate
without autoencodeDisabled - OR if the template is null or otherwise not a
ConfluenceVelocityTemplate
and the context _is_ or _wraps anOutputMimeTypeAwareContext
with a mimetype of html
- Parameters:
context
- a context which will be handled specially if it is anOutputMimeTypeAwareContext
or is anInternalContextAdapter
containing anOutputMimeTypeAwareContext
.template
- a nullable template which will be handled specially if it's aConfluenceVelocityTemplate
- Returns:
- true if autoencoding should be enabled for this context and template.
- if the template is a
-
shouldAutoEncode
public boolean shouldAutoEncode(org.apache.velocity.context.Context context)
-
getReferenceInsertionEventHandler
public org.apache.velocity.app.event.ReferenceInsertionEventHandler getReferenceInsertionEventHandler(org.apache.velocity.context.Context context)
- Specified by:
getReferenceInsertionEventHandler
in interfacecom.atlassian.velocity.htmlsafe.ReferenceInsertionPolicy
-
-