public interface UrlCreator extends UrlCreator
UrlCreator
. Since FirstSpirit v5
none of these interfaces should be implemented. Instead implement the interface UrlFactory
, refer to the
developer documentation for more details.
Use this interface to determine the urls of medium
and
site-store
nodes or for
plugin elements
(like e.g. font images).
This interface provides methods to determine file names (for medium
and site-store
nodes, and for
plugin files
). Please note that these methods are not
supported in every environment. Most notably during preview processing. But there may be also situations when
generating where content is not stored in an ordinary file system (but e.g. in a database) so that
there is simply no file. You should be aware of this when using these methods. This also applies for the usage of
Mode.FILE_PATH
.ContentProcessor
.Modifier and Type | Interface and Description |
---|---|
static class |
UrlCreator.Factory
Factory to transform a legacy
UrlCreator implementation into a new
UrlCreator instance. |
static class |
UrlCreator.Mode
The different flavours an url can be created in.
|
Modifier and Type | Field and Description |
---|---|
static int |
ABSOLUTE_URL
Absolute link with prefix (e.g.
|
static int |
ABSOLUTE_URL_NO_PREFIX
Absolute link without prefix (e.g.
|
static List<UrlCreator.Mode> |
MODES
Unmodifieable list of mode values, sorted by ordinal.
|
static int |
RELATIVE_URL
relative link (e.g. "../..
|
Modifier and Type | Method and Description |
---|---|
void |
cleanUp()
Callback for clean up, called when the instance is not longer used.
|
String |
getFilename(ContentProducer contentProducer,
TemplateSet templateSet,
Language language,
PageParams pageParams)
The complete file name (relative to content root) where the produced content of the provided
contentProducer will be stored. |
String |
getFilename(Media media,
Language language,
Resolution resolution)
The complete file name (relative to content root) where the produced content of the provided
medium will be stored. |
String |
getFilename(String pluginName,
String filename,
String extension,
Language language)
The complete path (relative to content root) where the produced content of the provided
type will be stored. |
String |
getUrl(ContentProducer node,
Language language,
TemplateSet templateSet,
PageParams pageParams,
int mode)
Get the url for the specified page in the specified language.
|
String |
getUrl(Media media,
Language language,
Resolution resolution,
int mode)
Get the url for the specified medium (for the specified language and resolution).
|
String |
getUrl(String pluginName,
String filename,
String extension,
Language language,
int mode)
Get the url for the provided combination of
type , name , extension , and language . |
String |
getUrlPrefix()
Get the url prefix for absolute urls.
|
getFilename, init, setUrlPrefix
static final List<UrlCreator.Mode> MODES
static final int RELATIVE_URL
static final int ABSOLUTE_URL
static final int ABSOLUTE_URL_NO_PREFIX
@Nullable String getUrlPrefix()
getUrlPrefix
in interface UrlCreator
UrlCreator.setUrlPrefix(String)
String getFilename(ContentProducer contentProducer, TemplateSet templateSet, Language language, PageParams pageParams)
contentProducer
will be stored.
See the comment for file name methods.contentProducer
- node.templateSet
- template set.language
- language.pageParams
- the page params.String getUrl(ContentProducer node, Language language, TemplateSet templateSet, PageParams pageParams, int mode)
mode
is UrlCreator.Mode.RELATIVE_URL
the
url is relative to the actual node provided by GenerationContext
(which is set in method
UrlCreator.init(GenerationContext)
). The returned url must match the filename produced by
getFilename(de.espirit.firstspirit.access.store.ContentProducer, de.espirit.firstspirit.access.project.TemplateSet, Language, PageParams)
getFilename(..)} with the same parameter set.getUrl
in interface UrlCreator
node
- node.language
- language.templateSet
- template set.pageParams
- page params, containing e.g. the content id to which is linked.mode
- see UrlCreator.Mode
.getFilename(de.espirit.firstspirit.access.store.ContentProducer, de.espirit.firstspirit.access.project.TemplateSet, Language, PageParams)
String getFilename(Media media, Language language, Resolution resolution) throws IOException
medium
will be stored.
See the comment for file name methods.getFilename
in interface UrlCreator
media
- the media object.language
- the language instance.resolution
- the resolution instance.IOException
- if the backend throws an io exception.getUrl(de.espirit.firstspirit.access.store.mediastore.Media, Language, de.espirit.firstspirit.access.project.Resolution, int)
String getUrl(Media media, Language language, Resolution resolution, int mode) throws IOException
getFilename(..)
with the same parameter set.getUrl
in interface UrlCreator
media
- the media nodelanguage
- may be null
(for language independent media)resolution
- may be null
(for files)mode
- see UrlCreator.Mode
IOException
- if the backend throws an io exception.getFilename(de.espirit.firstspirit.access.store.mediastore.Media, Language, de.espirit.firstspirit.access.project.Resolution)
String getFilename(String pluginName, String filename, @Nullable String extension, @Nullable Language language)
type
will be stored. The (unique) pluginName usually will be mapped to a directory, the uniqueness of
the provided combination of filename
, extension
, and language
must be guaranteed by the
caller.
See the comment for file name methods.getFilename
in interface UrlCreator
pluginName
- (Unique) plugin name.filename
- filename of the file.extension
- extension of the file - may be null
if file has no extension.language
- language of the file - may be null
.getUrl(String, String, String, Language, int)
String getUrl(String pluginName, String filename, @Nullable String extension, @Nullable Language language, int mode)
type
, name
, extension
, and language
.
The returned url must match the filename produced by getFilename(..)
for the same combination.getUrl
in interface UrlCreator
pluginName
- (Unique) plugin name.filename
- file name of the file.extension
- extension of the file - may be null
if file has no extension.language
- language of the file - may be null
.mode
- see Enum.ordinal()
.getFilename(String, String, String, Language)
void cleanUp()
cleanUp
in interface UrlCreator
Copyright © 2014 e-Spirit AG. All Rights Reserved. Build 5.0_BETA.500