public interface UrlFactory
media
and
content producers
.
Instances are registered in the module.xml file like this:
<module>
<components>
<public>
<name>{name}</name>
<class>de.espirit.firstspirit.generate.UrlCreatorSpecification</class>
<configuration>
<UrlFactory>{full qualified class name}</UrlFactory>
<!-- insert parameters for your implementation here, see init(java.util.Map, PathLookup)
-->
</configuration>
</public>
</components>
</module>
If the data for a URI component would conflict with the reserved purpose, then the conflicting data must be escaped
before forming the URI. Reserved according to RFC-2396 are
";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" | "$" | ",".
Instances created by FirstSpirit are initialized
once before any other usage.
Implementations should be thread safe. This is best achieved by avoiding local state despite state derived from
initialization
.FilenameFactory
Modifier and Type | Method and Description |
---|---|
String |
getUrl(ContentProducer node,
TemplateSet templateSet,
Language language,
PageParams pageParams)
Calculate path to provided combination of node, template set, language, and page params.
|
String |
getUrl(Media node,
Language language,
Resolution resolution)
Calculate path to provided combination of node, language, and resolution.
|
default void |
init(Map<String,String> settings,
PathLookup pathLookup)
Initialization method.
|
default void |
setUp(UrlFactoryContext context)
Configures the in which the
UrlFactory is operating. |
default void init(@NotNull Map<String,String> settings, @NotNull PathLookup pathLookup)
pathLookup
for user defined paths.
Implementers note:
This method will only get called by the default implementation of setUp(UrlFactoryContext)
.
You must override the setUp-Method
if you don't want this to happen for your
implementation.
The default implementation of this method is just a stub and therefor does nothing.
settings
- Settings provided in module.xml file in section <configuration>..</configuration>
.
The key is the tag name (converted to lower case), value is the text child node. E.g. <key>value</key>
.pathLookup
- Path lookup for user defined paths.default void setUp(@NotNull UrlFactoryContext context)
UrlFactory
is operating.
If the instance is created by FirstSpirit this method is called once before any other usage.
For compatibility reasons the default implementation delegates to init(Map, PathLookup)
.
Implementers note:
It is not necessary to call the default implementation.
context
- The context for this UrlFactory
.@NotNull String getUrl(@NotNull ContentProducer node, @NotNull TemplateSet templateSet, @NotNull Language language, @NotNull PageParams pageParams)
node
- target node.templateSet
- target template set.language
- target language.pageParams
- the page params.@NotNull String getUrl(@NotNull Media node, @NotNull Language language, @Nullable Resolution resolution)
node
- Target node.language
- Target language.resolution
- Target resolution or null
for media nodes of type Media.FILE
.Copyright © 2021 e-Spirit AG. All Rights Reserved. Build 5.2.210210