Configuration

This section lists the available configuration components that can be used in the YAML configuration file.

Example config.yaml

throwErrorOnExtraParameters: true

certificateStore: !certificateStore
  ...

credentials:
  - !credential
    ...

proxies:
  - !proxy
    ...

templates:
  A4 Landscape: !template
    ...

!acceptAll

A matcher that always returns true.

Example

 http_processors 

Configuration

reject
Reverses the matcher. Instead of accepting an URI when the URI matches, the URI is rejected.

!alwaysAllowedAssertion

This assertion always allows access.

!andAssertion

An access assertion that throws fails if any of the encapsulated assertions fail.

Configuration

predicates
Set all the Predicates/AccessAssertion that have to all pass in order for this assertion to pass.

An exception is thrown if this method is called more than once.

!certificateStore

A configuration object for configuring a custom certificate/trust store.

It is a uri to a java jks keystore file along with the password for unlocking the store.

Configuration

configuration
Description copied from interface: HasConfiguration
password
The password for unlocking the certificate store.
uri
The uri to the certificate store. It is a uri to a java jks keystore file along with the password for unlocking the store.

!configuration

The Main Configuration Bean.

Configuration

access
The roles required to access this configuration/app. If empty or not set then it is a public app. If there are many roles then a user must have one of the roles in order to access the configuration/app.

The security (how authentication/authorization is done) is configured in the /WEB-INF/classes/mapfish-spring-security.xml

Any user without the required role will get an error when trying to access any of the templates and no templates will be listed in the capabilities requests.

allowedReferers
The matchers used to authorize the incoming requests in function of the referrer. For example:
 allowedReferers:
- !hostnameMatch
host: example.com
allowSubDomains: true

By default, the referrer is not checked

certificateStore
The configuration for locating a custom certificate store. This is only required if the default certificate store which ships with all java installations does not contain the certificates needed by this server. Usually it is to accept a self-signed certificate, for example on a test server.
configurationFile
credentials
Http credentials to be used when making http requests.

If a proxy needs credentials you don't need to configure it here because the proxy configuration object also has options for declaring the credentials.

defaultStyle
Set the default styles. the case of the keys are not important. The retrieval will be case insensitive.
defaultToSvg
If true then all vector layers (and other parts of the system that can be either SVG or Bitmap, like scalebar) will be rendered as SVG (unless layer specifically indicates useSvg as false).

The default is false.

fileLoaderManager
Set file loader manager.
jdbcDrivers
Set the JDBC drivers that are required to connect to the databases in the configuration. JDBC drivers are needed (for example) when database sources are used in templates. For example if in one of the template you have:
     jdbcUrl: "jdbc:postgresql://localhost:5432/morges_dpfe"

then you need to add:

     jdbcDrivers: [org.postgresql.Driver]

or

     jdbcDrivers:
- org.postgresql.Driver
opaqueTileErrorColor
Color used for tiles in error on opaque layers.
outputFilename
The default output file name of the report. This can be overridden by Template.setOutputFilename(String) and the outputFilename parameter in the request JSON.

This can be a string and can also have a date section in the string that will be filled when the report is created for example a section with ${} will be replaced with the current date formatted in the way defined by the string. The format rules are the rules in java.text.SimpleDateFormat (do a google search if the link above is broken).

Example: outputFilename: print-${dd-MM-yyyy} should output:
print-22-11-2014.pdf

Note: the suffix will be appended to the end of the name.

pdfConfig
Configure various properties related to the reports generated as PDFs.
proxies
Configuration for proxying http requests. Each proxy can be configured with authentication and with the uris that they apply to.

See HttpProxy for details on how to configure them.

resourceBundle
Set the resource bundle name.
smtp
styles
Set the named styles defined in the configuration for this.
templates
Set the configuration of the named template.
throwErrorOnExtraParameters
If true and the request JSON has extra parameters in the layers definition, exceptions will be thrown. Otherwise the information will be logged.
transparentTileErrorColor
Color used for tiles in error on transparent layers.

!credential

Represents a set of credentials to use for an http request. These can be configured in the Configuration yaml file.

Note: proxies are also HttpCredentials and when searching for credentials, the proxies will also be searched for credentials.

Configuration

matchers
Matchers are used to choose which requests the credentials apply to.
password
The password for authenticating with the credentials.

This is optional

username
The username for authenticating with the credentials.

This is optional

!dnsMatch

Allows to check that a given URL matches a DNS address (textual format). The actual comparison is performed on numerical IP addresses. The configured DNS host address is transformed into numerical IP addresses during application startup. The urls to be compared are transformed during the print processing.

Example 1: Accept any www.camptocamp.com url

     - !dnsMatch
host: www.camptocamp.com

Example 2: Accept any www.camptocamp.com url (port == -1 accepts any port)

     - !dnsMatch
host: www.camptocamp.com
port: -1

Example 3: Accept any www.camptocamp.com url on port 80 only

     - !dnsMatch
host: www.camptocamp.com
port: 80
Example 4: Accept www.camptocamp.com urls with paths that start with /print/.

If the regular expression give does not start with / then it will be added because all paths start with /

     - !dnsMatch
host: www.camptocamp.com
pathRegex: /print/.+

Example

 http_processors 

Configuration

host
Set the host.
pathRegex
The regular expression used to verify the path of the uri as is expected. All paths start with /.

The regular expression used are the ones supported by java: http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html

port
reject
Reverses the matcher. Instead of accepting an URI when the URI matches, the URI is rejected.

!hostnameMatch

Allows to check that a given URL matches a hostname literally (textual match).

Example 1: Accept any www.camptocamp.com url

     - !hostnameMatch
host: www.camptocamp.com

Example 2: Accept any www.camptocamp.com url (port == -1 accepts any port)

     - !hostnameMatch
host: www.camptocamp.com
port: -1

Example 3: Accept any www.camptocamp.com url on port 80 only

     - !hostnameMatch
host: www.camptocamp.com
port: 80
Example 4: Accept www.camptocamp.com urls with paths that start with /print/.

If the regular expression give does not start with / then it will be added because all paths start with /

     - !hostnameMatch
host: www.camptocamp.com
pathRegex: /print/.+

Configuration

allowSubDomains
Set if sub-domains are allowed.
host
Set the host.
pathRegex
The regular expression used to verify the path of the uri as is expected. All paths start with /.

The regular expression used are the ones supported by java: http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html

port
reject
Reverses the matcher. Instead of accepting an URI when the URI matches, the URI is rejected.

!ipMatch

Compares ip address string and mask string by using InetAddress comparison.

Example 1: accept any uri whose host matches the ip of www.camptocamp.com

     - !ipMatch
ip: www.camptocamp.com

Example 2: accept any uri whose host ip starts with 192.1

     - !ipMatch
ip: 192.1.0.0
mask: 255.255.0.0

Example 3: accept any uri whose host ip starts with 192.1 and restricts to port 80

     - !ipMatch
ip: 192.1.0.0
mask: 255.255.0.0
port: 80

Example 4: accept any uri whose host ip starts with 192.1 and and allows any port (-1 is any port)

     - !ipMatch
ip: 192.1.0.0
mask: 255.255.0.0
port: -1

Example 5: accept any uri whose host ip starts with 192.1 and restricts to paths that start with /print/

     - !ipMatch
ip: 192.1.0.0
mask: 255.255.0.0
pathRegex: /print/.+

Example

 http_processors 

Configuration

ip
Set the allowed ip address for this matcher.
mask
Set the Mask to apply to the ip address obtained from the URI that is being tested.
pathRegex
The regular expression used to verify the path of the uri as is expected. All paths start with /.

The regular expression used are the ones supported by java: http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html

port
reject
Reverses the matcher. Instead of accepting an URI when the URI matches, the URI is rejected.

!localMatch

Allows to check that a given URL is served by one of the local network interface or one of its aliases.

Example 1: Accept any localhost url

     - localMatch {}

Example 2: Accept any localhost url (port == -1 accepts any port)

     - localMatch
port: -1

Example 3: Accept any localhost url on port 80 only

     - localMatch
port: 80

Example 4: Accept localhost urls with paths that start with /print/.

If the regular expression given does not start with / then it will be added because all paths start with /.

     - localMatch
pathRegex: /print/.+

Example

 http_processors 

Configuration

pathRegex
The regular expression used to verify the path of the uri as is expected. All paths start with /.

The regular expression used are the ones supported by java: http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html

port
reject
Reverses the matcher. Instead of accepting an URI when the URI matches, the URI is rejected.

!mergeSource

Describes the objects used as sources for a merged data source (see !mergeDataSources processor).

Configuration

fields
The names of each field in the DataSource. See MergeDataSourceProcessor.SourceType for instructions on how to declare the fields
key
The key to use when looking for the object among the attributes and the processor output values.
type
The type of source. See MergeDataSourceProcessor.SourceType for the options.

!pdfConfig

A Configuration object for containing metadata that will be embedded in the PDF and parameters to use when encoding the PDF.

Naturally this only applies to reports that are exported as PDFs.

Configuration

author
Set the author of the PDF.
compressed
If this property is set to true then the resulting PDF will be a compressed PDF. By default the PDF is not compressed.
creator
Set the creator of the PDF.
keywords
The keywords to include in the PDF metadata.
subject
Set the subject of the PDF.
title
Set the title of the PDF.

!proxy

This configuration object configures the proxies to be used by the system. This is configured as one of the root elements of the config.yaml

Example - Proxy all requests except localhost and www.camptocamp.org:

 proxies:
- !proxy
scheme: http
host: proxy.host.com
port: 8888
username: username
password: xyzpassword
matchers:
- !localMatch
reject: true
- !dnsMatch
host: www.camptocamp.org
reject: true
- !acceptAll {}

Configuration

host
The host of the proxy. Can be a hostname or ip address.

This is required.

matchers
Matchers are used to choose which requests this proxy applies to.
password
The password for authenticating with the proxy.

This is optional

port
The host of the proxy. Can be a hostname or ip address.

This is optional. The default value is 80.

scheme
The scheme (http, https) of the proxy.

This is optional, default is http if no username and https if there is a password

username
The username for authenticating with the proxy.

This is optional

!roleAccessAssertion

An access assertion that verifies that the current user has the required roles.

Configuration

requiredRoles
Set the roles required to allow access. If not roles then the user must be logged in but does not have to have any particular role.

This method may only be called once, any subsequent calls will result in errors.

!s3reportStorage

Configuration for storing the reports in a S3 compatible storage.

By default, authentication is done using the DefaultAWSCredentialsProviderChain which uses Environment Variables, Java System Properties, Credential profiles file, ...

Configuration

accessKey
To set the access key.
bucket
The S3 bucket to use.
endpointUrl
To override the endpoint URL (for non-Amazon, S3 compatible servers).
prefix
The key prefix to use.
region
To set the region to use.
retentionDays
The number of day the reports must be kept.

Passed this delay, they will be deleted and the links included in the corresponding emails will become invalid. Defaults to 7 days.

secretKey
To set the secret key.

!smtpConfig

Email sending configuration.

This configuration is needed only if reports are to be sent to the user by email.

Configuration

body
The default email body.

This can be changed by the smtp.body property in the request.

If you have setup a storage, you must put a "{url}" marker where the URL to fetch the report should be put.

errorBody
The default email body in case of error.

This can be changed by the smtp.body property in the request.

The error message can be places in the text using a "{message}" marker.

errorSubject
The default email subject in case of error.

This can be changed by the smtp.errorSubject property in the request.
fromAddress
The email address used as "From:" in every email.
host
The SMTP server hostname.
password
If auth is needed, the password.
port
The TCP port of the SMTP server.
ssl
True for enabling SSL.

Cannot be enabled at the same time as starttls
starttls
True to use STARTTLS.
storage
The report storage facility to use.

By default, attaches the report in an email. But, for big files, this is not practical. This can be used to configure a storage.
subject
The default email subject.

This can be changed by the smtp.subject property in the request.
username
If auth is needed, the username.

!template

Represents a report template configuration.

Configuration

access
The roles required to access this template. If empty or not set then it is a public template. If there are many roles then a user must have one of the roles in order to access the template.

The security (how authentication/authorization is done) is configured in the /WEB-INF/classes/mapfish-spring-security.xml

Any user without the required role will get an error when trying to access the template and the template will not be visible in the capabilities requests.

attributes
Set the attributes for this template.
configuration
Description copied from interface: HasConfiguration
jdbcDrivers
jdbcPassword
jdbcUrl
jdbcUser
mapExport
outputFilename
The default output file name of the report (takes precedence over Configuration.setOutputFilename(String)). This can be overridden by the outputFilename parameter in the request JSON.

This can be a string and can also have a date section in the string that will be filled when the report is created for example a section with ${} will be replaced with the current date formatted in the way defined by the string. The format rules are the rules in java.text.SimpleDateFormat (do a google search if the link above is broken).

Example: outputFilename: print-${dd-MM-yyyy} should output:
print-22-11-2014.pdf

Note: the suffix will be appended to the end of the name.

pdfA
If set to true (defaults to false), the generated maps, scalebar and north arrow will not contain any transparent images.

This is needed in case you want to output PDF/A-1a reports.

In pdfA mode, all layers are merged into a single JPEG layer at the requested resolution: WMTS tiles will be downscaled and vector layers will be rendered as bitmaps.

pdfConfig
Configure various properties related to the reports generated as PDFs.
processors
Set the normal processors.
reportTemplate
styles
Set the named styles defined in the configuration for this.
tableData
Set the key of the data that is the datasource for the main table in the report.

!updatePdfConfigUpdate

The object that defines how to update the PDFConfig (see !updatePdfConfig processor).

Configuration

format
The replacement format. It is a printf style format. The documentation is in the Formatter class (just google/bing java.util.Formatter).

Example: "Report for %s"

valueKey
The key to use to look up the value in the values object. It can be a path that can reach into nested objects.

Examples 1 a simple lookup key: "key" Example 2 a path. First part (before .) is the lookup key, the second part is the field name to load: "key.fieldName"

!urlImage

Interprets text in a table cell as an image URL.

See also: Configuration of tables with HTML images

Configuration

urlExtractor
Sets the RegExp pattern to use for extracting the url from the text. By default, the whole string is used.

For example: .*&img src="([^"]+)".*

urlGroup
Select the group in the regular expression that contains the url.

!zoomLevels

Encapsulates a sorted set of scale denominators representing the allowed scales.

The scales are sorted from largest to smallest and the index starts at 0, where 0 is the largest scale (most zoomed out).

   map: !map
zoomLevels: !zoomLevels
scales: [5000, 10000, 25000, 50000, 100000, 500000]

Configuration

scales
Set the scales (sorts from largest to smallest).