Class TemplatedURLBuilder
java.lang.Object
net.shibboleth.utilities.java.support.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 Object
A custom object to inject into the template.private org.apache.velocity.app.VelocityEngine
VelocityEngine.private final Escaper
Escaper for fragments.private final org.slf4j.Logger
Class logger.private final Escaper
Escaper for form parameters.private final Escaper
Escaper for path segments.private Template
Template to be evaluated.private String
Text of template to be evaluated. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Get the template to be evaluated.Get the template text to be evaluated.protected String
getURL
(AttributeResolutionContext resolutionContext, Map<String, List<IdPAttributeValue>> dependencyAttributes) Method to return the URL to access via GET.org.apache.velocity.app.VelocityEngine
Get theVelocityEngine
to be used.protected String
merge
(org.apache.velocity.VelocityContext context) InvokesTemplate.merge(org.apache.velocity.context.Context)
on the supplied context.void
setCustomObject
(Object object) Set the custom (externally provided) object.void
setTemplateText
(String text) Set the template to be evaluated.void
setVelocityEngine
(org.apache.velocity.app.VelocityEngine velocityEngine) Set theVelocityEngine
to be used.Methods inherited from class net.shibboleth.idp.attribute.resolver.dc.http.impl.AbstractHTTPSearchBuilder
build, getHeaders, getHttpClientSecurityParameters, getHttpRequest, getResultCacheKey, setHeaders, setHttpClientSecurityParameters
Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
destroy, doDestroy, 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 theVelocityEngine
to be used.- Returns:
- template engine
-
setVelocityEngine
public void setVelocityEngine(@Nonnull org.apache.velocity.app.VelocityEngine velocityEngine) Set theVelocityEngine
to be used.- Parameters:
velocityEngine
- engine to be used
-
setCustomObject
Set the custom (externally provided) object.- Parameters:
object
- the custom object
-
doInitialize
- Overrides:
doInitialize
in 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:
getURL
in classAbstractHTTPSearchBuilder
- Parameters:
resolutionContext
- the context of the resolutiondependencyAttributes
- made available to the request- Returns:
- the URL to GET
- Throws:
ResolutionException
- if an error occurs
-