Class TemplatedURLBuilder
java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.idp.attribute.resolver.dc.http.impl.AbstractHTTPSearchBuilder
net.shibboleth.idp.attribute.resolver.dc.http.impl.TemplatedURLBuilder
- All Implemented Interfaces:
ExecutableSearchBuilder<HTTPSearch>,Component,DestructableComponent,InitializableComponent
An
ExecutableSearchBuilder that generates the URL to
request by evaluating a Template against the currently resolved attributes within an
AttributeResolutionContext.-
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 TypeMethodDescriptionprotected voidGet the template to be evaluated.Get the template text to be evaluated.protected StringgetURL(AttributeResolutionContext resolutionContext, Map<String, List<IdPAttributeValue>> dependencyAttributes) Method to return the URL to access via GET.org.apache.velocity.app.VelocityEngineGet theVelocityEngineto be used.protected 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.idp.attribute.resolver.dc.http.impl.AbstractHTTPSearchBuilder
build, getHeaders, getHttpClientSecurityParameters, getHttpRequest, getResultCacheKey, setHeaders, setHttpClientSecurityParametersMethods 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
-
TemplatedURLBuilder
public TemplatedURLBuilder()Constructor.
-
-
Method Details
-
getTemplate
Get the template to be evaluated.- Returns:
- template
-
getTemplateText
Get the template text to be evaluated.- Returns:
- template text
-
setTemplateText
Set the template to be evaluated.- Parameters:
text- template to be evaluated
-
getVelocityEngine
Get theVelocityEngineto be used.- Returns:
- template engine
-
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
-
getURL
@Nonnull protected String getURL(@Nonnull AttributeResolutionContext resolutionContext, @Nonnull Map<String, List<IdPAttributeValue>> dependencyAttributes) throws ResolutionExceptionMethod to return the URL to access via GET.Subclasses may override this method to support simple GET requests.
- Overrides:
getURLin classAbstractHTTPSearchBuilder- Parameters:
resolutionContext- the context of the resolutiondependencyAttributes- made available to the request- Returns:
- the URL to GET
- Throws:
ResolutionException- if an error occurs
-