Package net.shibboleth.idp.attribute.resolver.dc.http.impl

# 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`

public class TemplatedURLBuilder extends AbstractHTTPSearchBuilder
An `ExecutableSearchBuilder` that generates the URL to request by evaluating a `Template` against the currently resolved attributes within an `AttributeResolutionContext`.

## Field Summary

Fields
Modifier and Type
Field
Description
`private Object`
`customObject`
A custom object to inject into the template.
`private org.apache.velocity.app.VelocityEngine`
`engine`
VelocityEngine.
`private final Escaper`
`fragmentEscaper`
Escaper for fragments.
`private final org.slf4j.Logger`
`log`
Class logger.
`private final Escaper`
`paramEscaper`
Escaper for form parameters.
`private final Escaper`
`pathEscaper`
Escaper for path segments.
`private Template`
`template`
Template to be evaluated.
`private String`
`templateText`
Text of template to be evaluated.

## Constructor Summary

Constructors
Constructor
Description
`TemplatedURLBuilder()`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`protected void`
`doInitialize()`
`Template`
`getTemplate()`
Get the template to be evaluated.
`String`
`getTemplateText()`
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`
`getVelocityEngine()`
Get the `VelocityEngine` to be used.
`protected String`
`merge(org.apache.velocity.VelocityContext context)`
Invokes `Template.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 the `VelocityEngine` 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.shared.component.AbstractInitializableComponent

`checkComponentActive, checkSetterPreconditions, destroy, doDestroy, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentException, initialize, isDestroyed, isInitialized`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### log

@Nonnull private final org.slf4j.Logger log
Class logger.

### template

@NonnullAfterInit private Template template
Template to be evaluated.

### templateText

@NonnullAfterInit private String templateText
Text of template to be evaluated.

### engine

@NonnullAfterInit private org.apache.velocity.app.VelocityEngine engine
VelocityEngine.

### paramEscaper

@Nonnull private final Escaper paramEscaper
Escaper for form parameters.

### fragmentEscaper

@Nonnull private final Escaper fragmentEscaper
Escaper for fragments.

### pathEscaper

@Nonnull private final Escaper pathEscaper
Escaper for path segments.

### customObject

@Nullable private Object customObject
A custom object to inject into the template.

## Constructor Details

### TemplatedURLBuilder

public TemplatedURLBuilder()
Constructor.

## Method Details

### getTemplate

@NonnullAfterInit public Template getTemplate()
Get the template to be evaluated.

Returns:
  template

### getTemplateText

@NonnullAfterInit public String getTemplateText()
Get the template text to be evaluated.

Returns:
  template text

### setTemplateText

public void setTemplateText(@Nullable String text)
Set the template to be evaluated.

Parameters:
  `text` - template to be evaluated

### getVelocityEngine

@NonnullAfterInit public org.apache.velocity.app.VelocityEngine getVelocityEngine()
Get the `VelocityEngine` to be used.

Returns:
  template engine

### setVelocityEngine

public void setVelocityEngine(@Nonnull org.apache.velocity.app.VelocityEngine velocityEngine)
Set the `VelocityEngine` to be used.

Parameters:
  `velocityEngine` - engine to be used

### setCustomObject

public void setCustomObject(@Nullable Object object)
Set the custom (externally provided) object.

Parameters:
  `object` - the custom object

### doInitialize

protected void doInitialize() throws ComponentInitializationException

Overrides:
  `doInitialize` in class `AbstractInitializableComponent`
Throws:
  `ComponentInitializationException`

### merge

@Nonnull @NotEmpty protected String merge(@Nonnull org.apache.velocity.VelocityContext context)
Invokes `Template.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 ResolutionException
Method to return the URL to access via GET.

Subclasses may override this method to support simple GET requests.

Overrides:
  `getURL` in class `AbstractHTTPSearchBuilder`
Parameters:
  `resolutionContext` - the context of the resolution
  `dependencyAttributes` - made available to the request
Returns:
  the URL to GET
Throws:
  `ResolutionException` - if an error occurs