jbjonesjr / mapfish-print

A component of http://www.mapfish.org for printing templated cartographic maps. This module is the java serverside module. It works well with the mapfish print javascript module.
http://www.mapfish.org/doc/print/
GNU General Public License v3.0
2 stars 0 forks source link

Printer Caching in BaseMapServlet is too optimistic #3

Open jbjonesjr opened 12 years ago

jbjonesjr commented 12 years ago

Mapfish is a bit too optimistic on it's configuration caching. If you don't specify an app parameter when calling a method, Mapfish will only re-read the config file from disk (slow) if the file has been modified since last read. If you do specify an app param, It resets the cache time and reads the file again (if it has changed). The problem arises if the printer variable has already been set (aka, this is not your first request) and you are requesting the default configuration. The printer property is not reset to be null, therefore meaning no file reloading (a problem if the current printer is for ANOTHER app). Setting printer to be null should fix this, but there is likely a more elegant solution that can reduce some of the code in this process.

jbjonesjr commented 12 years ago

Reproduction steps:

Access http://geo.jbjonesjr.com:8080/geoserver/pdf/info.json , see all outputFormats are available as per the default config file.
Access http://geo.jbjonesjr.com:8080/geoserver/pdf/info.json?app=app1 , see that only a pdf outputFormat is available as per the app1 config file
Access http://geo.jbjonesjr.com:8080/geoserver/pdf/info.json again, and see that still only pdf is available.  The last file was incorrectly cached!!  This is because the app1 printer object is still set.