Class TemplateRequestURLBuilder
- java.lang.Object
-
- org.opensaml.saml.metadata.resolver.impl.TemplateRequestURLBuilder
-
- All Implemented Interfaces:
Function<CriteriaSet,String>
public class TemplateRequestURLBuilder extends Object implements Function<CriteriaSet,String>
Function which produces a URL by substituting an entity ID value from criteria into a Velocity template string.The entity ID will be replaced in the template string according to the template variable
entityID, e.g. "https://metadataservice.com/entity/${entityID}".The value of the
encodingStyleparameter determines whether and how the entity ID will be encoded prior to substitution, and accepts an enum value fromTemplateRequestURLBuilder.EncodingStyle. Legacy deprecated constructors accept anencodedparameter, wheretruemeansTemplateRequestURLBuilder.EncodingStyle.formandfalsemeansTemplateRequestURLBuilder.EncodingStyle.none.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTemplateRequestURLBuilder.EncodingStyleEntityID Encoding style.
-
Field Summary
Fields Modifier and Type Field Description static StringCONTEXT_KEY_ENTITY_IDThe Velocity context variable name for the entity ID.private TemplateRequestURLBuilder.EncodingStyleentityIDEncodingStyleEnum value indicating whether and how to encode the entity ID value before substitution.private org.slf4j.LoggerlogLogger.private TemplatetemplateVelocity template instance used to render the request URL.private StringtemplateTextThe template text, for logging purposes.private Function<String,String>transformerFunction which transforms the entityID prior to substitution into the template.
-
Constructor Summary
Constructors Constructor Description TemplateRequestURLBuilder(org.apache.velocity.app.VelocityEngine engine, String templateString, TemplateRequestURLBuilder.EncodingStyle encodingStyle)Constructor.TemplateRequestURLBuilder(org.apache.velocity.app.VelocityEngine engine, String templateString, TemplateRequestURLBuilder.EncodingStyle encodingStyle, Function<String,String> transform)Constructor.TemplateRequestURLBuilder(org.apache.velocity.app.VelocityEngine engine, String templateString, TemplateRequestURLBuilder.EncodingStyle encodingStyle, Function<String,String> transform, Charset charSet)Constructor.
-
-
-
Field Detail
-
CONTEXT_KEY_ENTITY_ID
public static final String CONTEXT_KEY_ENTITY_ID
The Velocity context variable name for the entity ID.- See Also:
- Constant Field Values
-
log
private final org.slf4j.Logger log
Logger.
-
template
private Template template
Velocity template instance used to render the request URL.
-
templateText
private String templateText
The template text, for logging purposes.
-
transformer
private Function<String,String> transformer
Function which transforms the entityID prior to substitution into the template.
-
entityIDEncodingStyle
private TemplateRequestURLBuilder.EncodingStyle entityIDEncodingStyle
Enum value indicating whether and how to encode the entity ID value before substitution.
-
-
Constructor Detail
-
TemplateRequestURLBuilder
public TemplateRequestURLBuilder(@Nonnull org.apache.velocity.app.VelocityEngine engine, @Nonnull @NotEmpty String templateString, @Nullable TemplateRequestURLBuilder.EncodingStyle encodingStyle)Constructor.The template character set will be US ASCII.
- Parameters:
engine- theVelocityEngineinstance to usetemplateString- the Velocity template stringencodingStyle- the style for encoding the entity ID prior to substitution, null meansTemplateRequestURLBuilder.EncodingStyle.none
-
TemplateRequestURLBuilder
public TemplateRequestURLBuilder(@Nonnull org.apache.velocity.app.VelocityEngine engine, @Nonnull @NotEmpty String templateString, @Nullable TemplateRequestURLBuilder.EncodingStyle encodingStyle, @Nullable Function<String,String> transform)Constructor.The template character set will be US ASCII.
- Parameters:
engine- theVelocityEngineinstance to usetemplateString- the Velocity template stringtransform- function which transforms the entityID prior to substitution, may be nullencodingStyle- the style for encoding the entity ID prior to substitution, null meansTemplateRequestURLBuilder.EncodingStyle.none
-
TemplateRequestURLBuilder
public TemplateRequestURLBuilder(@Nonnull org.apache.velocity.app.VelocityEngine engine, @Nonnull @NotEmpty String templateString, TemplateRequestURLBuilder.EncodingStyle encodingStyle, @Nullable Function<String,String> transform, @Nullable Charset charSet)Constructor.- Parameters:
engine- theVelocityEngineinstance to usetemplateString- the Velocity template stringencodingStyle- the style for encoding the entity ID prior to substitution, null meansTemplateRequestURLBuilder.EncodingStyle.nonetransform- function which transforms the entityID prior to substitution, may be nullcharSet- character set of the template, may be null
-
-
Method Detail
-
apply
@Nullable public String apply(@Nullable CriteriaSet criteria)
- Specified by:
applyin interfaceFunction<CriteriaSet,String>
-
-