Class HttpImageResolver

java.lang.Object
org.mapfish.print.processor.jasper.HttpImageResolver
All Implemented Interfaces:
ConfigurationObject, TableColumnConverter<BufferedImage>

public final class HttpImageResolver extends Object implements 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 Details

    • HttpImageResolver

      public HttpImageResolver()
      Constructor.
  • Method Details

    • setUrlExtractor

      public void setUrlExtractor(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 BufferedImage resolve(MfClientHttpRequestFactory requestFactory, String text)
      Description copied from interface: TableColumnConverter
      Convert the value.
      Specified by:
      resolve in interface TableColumnConverter<BufferedImage>
      Parameters:
      requestFactory - for fetching file and http resources.
      text - the cell value.
    • validate

      public void validate(List<Throwable> validationErrors, Configuration configuration)
      Description copied from interface: ConfigurationObject
      validate that the configuration was correct.
      Specified by:
      validate in interface ConfigurationObject
      Parameters:
      validationErrors - a list to add any detected errors to.
      configuration - the containing configuration
    • canConvert

      public boolean canConvert(String text)
      Description copied from interface: TableColumnConverter
      Returns true if the converter can convert the given input.
      Specified by:
      canConvert in interface TableColumnConverter<BufferedImage>
      Parameters:
      text - the input to convert.