Package net.shibboleth.sp.util
Class TemplatedStringLookupStrategy
java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.sp.util.TemplatedStringLookupStrategy
- All Implemented Interfaces:
Function<ProfileRequestContext,,String> Component,DestructableComponent,InitializableComponent
public class TemplatedStringLookupStrategy
extends AbstractInitializableComponent
implements Function<ProfileRequestContext,String>
General strategy function for producing a String value from a String-based Velocity
template.
Specialized inputs to the Velocity context are provided based on relevant inputs to operations by Agents.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ObjectA custom object to inject into the template.private org.apache.velocity.app.VelocityEngineVelocityEngine.private final EscaperEscaper for fragments.private final org.slf4j.LoggerClass logger.private final EscaperEscaper for form parameters.private final EscaperEscaper for path segments.private TemplateTemplate to be evaluated.private StringText of template to be evaluated. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionapply(ProfileRequestContext profileRequestContext) protected voidprotected Stringmerge(org.apache.velocity.VelocityContext context) InvokesTemplate.merge(org.apache.velocity.context.Context)on the supplied context.voidsetCustomObject(Object object) Set the custom (externally provided) object.voidsetTemplateText(String text) Set the template to be evaluated.voidsetVelocityEngine(org.apache.velocity.app.VelocityEngine velocityEngine) Set theVelocityEngineto be used.Methods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent
checkComponentActive, checkSetterPreconditions, destroy, doDestroy, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentException, initialize, isDestroyed, isInitialized
-
Field Details
-
log
@Nonnull private final org.slf4j.Logger logClass logger. -
template
Template to be evaluated. -
templateText
Text of template to be evaluated. -
engine
VelocityEngine. -
paramEscaper
Escaper for form parameters. -
fragmentEscaper
Escaper for fragments. -
pathEscaper
Escaper for path segments. -
customObject
A custom object to inject into the template.
-
-
Constructor Details
-
TemplatedStringLookupStrategy
public TemplatedStringLookupStrategy()Constructor.
-
-
Method Details
-
setTemplateText
Set the template to be evaluated.- Parameters:
text- template to be evaluated
-
setVelocityEngine
public void setVelocityEngine(@Nonnull org.apache.velocity.app.VelocityEngine velocityEngine) Set theVelocityEngineto be used.- Parameters:
velocityEngine- engine to be used
-
setCustomObject
Set the custom (externally provided) object.- Parameters:
object- the custom object
-
doInitialize
- Overrides:
doInitializein classAbstractInitializableComponent- Throws:
ComponentInitializationException
-
merge
InvokesTemplate.merge(org.apache.velocity.context.Context)on the supplied context.- Parameters:
context- to merge- Returns:
- result of the merge operation
-
apply
- Specified by:
applyin interfaceFunction<ProfileRequestContext,String>
-