Class HttpImageResolver
java.lang.Object
org.mapfish.print.processor.jasper.HttpImageResolver
- All Implemented Interfaces:
ConfigurationObject
,TableColumnConverter<BufferedImage>
Interprets text in a table cell as an image URL.
See also: Configuration of tables with HTML images [[examples=datasource_many_dynamictables_legend]]
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
canConvert
(String text) Returns true if the converter can convert the given input.resolve
(MfClientHttpRequestFactory requestFactory, String text) Convert the value.void
setUrlExtractor
(String pattern) Sets the RegExp pattern to use for extracting the url from the text.void
setUrlGroup
(int urlGroup) Select the group in the regular expression that contains the url.void
validate
(List<Throwable> validationErrors, Configuration configuration) validate that the configuration was correct.
-
Constructor Details
-
HttpImageResolver
public HttpImageResolver()Constructor.
-
-
Method Details
-
setUrlExtractor
Sets the RegExp pattern to use for extracting the url from the text. By default, the whole string is used.For example:
.*&img src="([^"]+)".*
- Parameters:
pattern
- The url extractor regular expression. Default is"(.*)"
-
setUrlGroup
public void setUrlGroup(int urlGroup) Select the group in the regular expression that contains the url.- Parameters:
urlGroup
- the index of the group (starting at 1) that contains the url.
-
resolve
Description copied from interface:TableColumnConverter
Convert the value.- Specified by:
resolve
in interfaceTableColumnConverter<BufferedImage>
- Parameters:
requestFactory
- for fetching file and http resources.text
- the cell value.
-
validate
Description copied from interface:ConfigurationObject
validate that the configuration was correct.- Specified by:
validate
in interfaceConfigurationObject
- Parameters:
validationErrors
- a list to add any detected errors to.configuration
- the containing configuration
-
canConvert
Description copied from interface:TableColumnConverter
Returns true if the converter can convert the given input.- Specified by:
canConvert
in interfaceTableColumnConverter<BufferedImage>
- Parameters:
text
- the input to convert.
-