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.

!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).

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.

!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.

!oldApi

Configuration options for how requests to the old API are handled.

Example

 oldApi: !oldApi
layersFirstIsBaseLayer: false
wmsReverseLayers: true
templates:
..

Configuration

layersFirstIsBaseLayer
If true then the first layer in the layers array in the JSON request is the bottom layer of the map.
wmsReverseLayers
Set if the layer order coming from the old API client will be reversed for the layers within a WMS request.

!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.

!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
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.

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).