public class FileToPathTransformer extends Object implements org.apache.commons.collections.Transformer
AppSettings.RESOURCE_REL_TO_WEB_CNTXT
)
, where the base path is configured as AppSettings.CONTEXT_BASE_ABSOLUTE_PATH
AppSettings
. To be safe ensure any Spring Bean definition either sets it explicitly or depends-on appSettings componentProductDetailsTemplatePanel,
FileUploadWrapper (the way the paths are derived should match this),
{@link AppSettings} (relies on default Application settings if none provided)
Constructor and Description |
---|
FileToPathTransformer() |
Modifier and Type | Method and Description |
---|---|
AppSettings |
getAppSettings()
Its important to set this during
init() as during execution the transformer
maybe called by another Thread. |
String |
getWebSpecificAbsolutePath()
An absolute path that is relative to
SiteApplication#CONTEXT_BASE_ABSOLUTE_PATH
will remove any reference to the SiteApplication#CONTEXT_BASE_ABSOLUTE_PATH part and keep the path relative to the Web Context
specified by this path. |
void |
init() |
boolean |
isResourceRelativeToWebContext() |
void |
setAppSettings(AppSettings appSettings)
Its important to set this during
init() as during execution the transformer
maybe called by another Thread. |
void |
setWebSpecificAbsolutePath(String webSpecificAbsolutePath)
An absolute path that is relative to
SiteApplication#CONTEXT_BASE_ABSOLUTE_PATH
will remove any reference to the SiteApplication#CONTEXT_BASE_ABSOLUTE_PATH part and keep the path relative to the Web Context
specified by this path. |
Object |
transform(Object input) |
public boolean isResourceRelativeToWebContext()
@PostConstruct public void init()
public Object transform(Object input)
transform
in interface org.apache.commons.collections.Transformer
public String getWebSpecificAbsolutePath()
SiteApplication#CONTEXT_BASE_ABSOLUTE_PATH
will remove any reference to the SiteApplication#CONTEXT_BASE_ABSOLUTE_PATH
part and keep the path relative to the Web Context
specified by this path.
Example: /home/abc/www/img/catalog/mainImages/a.txt will become /img/catalog/a.txt assuming webSpecificAbsolutePath = /home/abc/www/img/catalog
public void setWebSpecificAbsolutePath(String webSpecificAbsolutePath)
SiteApplication#CONTEXT_BASE_ABSOLUTE_PATH
will remove any reference to the SiteApplication#CONTEXT_BASE_ABSOLUTE_PATH
part and keep the path relative to the Web Context
specified by this path.
Example: /home/abc/www/img/catalog/mainImages/a.txt will become /img/catalog/a.txt assuming webSpecificAbsolutePath = /home/abc/www/img/catalog
public AppSettings getAppSettings()
init()
as during execution the transformer
maybe called by another Thread. in which case AppSettings.get()
may not be defined.public void setAppSettings(AppSettings appSettings)
init()
as during execution the transformer
maybe called by another Thread. in which case AppSettings.get()
may not be defined.Copyright © 2018. All rights reserved.