Class HttpImageResolver
- java.lang.Object
-
- org.mapfish.print.processor.jasper.HttpImageResolver
-
- All Implemented Interfaces:
ConfigurationObject
,TableColumnConverter<java.awt.image.BufferedImage>
public final class HttpImageResolver extends java.lang.Object implements TableColumnConverter<java.awt.image.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 Constructor Description HttpImageResolver()
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canConvert(java.lang.String text)
Returns true if the converter can convert the given input.java.awt.image.BufferedImage
resolve(MfClientHttpRequestFactory requestFactory, java.lang.String text)
Convert the value.void
setUrlExtractor(java.lang.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(java.util.List<java.lang.Throwable> validationErrors, Configuration configuration)
validate that the configuration was correct.
-
-
-
Method Detail
-
setUrlExtractor
public void setUrlExtractor(java.lang.String pattern)
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
public java.awt.image.BufferedImage resolve(MfClientHttpRequestFactory requestFactory, java.lang.String text)
Description copied from interface:TableColumnConverter
Convert the value.- Specified by:
resolve
in interfaceTableColumnConverter<java.awt.image.BufferedImage>
- Parameters:
requestFactory
- for fetching file and http resources.text
- the cell value.
-
validate
public void validate(java.util.List<java.lang.Throwable> validationErrors, Configuration configuration)
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
public boolean canConvert(java.lang.String text)
Description copied from interface:TableColumnConverter
Returns true if the converter can convert the given input.- Specified by:
canConvert
in interfaceTableColumnConverter<java.awt.image.BufferedImage>
- Parameters:
text
- the input to convert.
-
-