Mapfish print module : sending a POST request, then changed in GET ?
Description
Environment
Windows 10
Oracle Spatial Database for vectorial data
Some external WMS coming from MapServer or OSM
Activity

Mauro Bartolomeoli December 19, 2017 at 8:31 AM
I think we can close the issue, since it's not really a GeoServer issue.

Jean-Christophe Bastin December 19, 2017 at 8:28 AM
Thank you for your answer. That's what I thought.
Just for any help it could give to anyone else, I finally did a workaround. My layer is initially linked to an Oracle table. I changed it to add a satellite table to store primary key (as foreign key), a date (for sustainability) and a token. I created a view linking these two tables. Before I send the print request to Mapfish, I first do a kind of cache in database, storing what I have to filter (if I have to filter like 1000 records, I store them in the satellite table with a unique token). Then I do the real Mapfish request with only the token as filter on the Oracle view.
I know this is not a wonderful solution, but this is all I found for now, and it works well.
Regards,
JCB

Mauro Bartolomeoli December 18, 2017 at 9:07 AM
To my knowledge, MapFish print currently only supports fetching WMS images using HTTP GET. I don't think we cannot override that from GeoServer.
This is where images loading happens: https://github.com/mapfish/mapfish-print/blob/2.1.x/src/main/java/org/mapfish/print/PDFUtils.java#L185
You are confusing the fact that you send a POST request to GeoServer to ask printing a map, with the requests that mapfish-print sends to the sources of layers of your maps (e.g. WMS services). Those are handled by mapfish-print internally and the behaviour does not change if you use GET or POST in your print request.
Details
Details
Assignee
Reporter

I first posted this issue on https://github.com/mapfish/mapfish-print, but they told me that it's a Geoserver issue. I got the answer "You POST request is sent to GeoServer, then it's GeoServer choosing to do a GET to MapFish Print".
Here is the initial explanation :
Hello everyone,
I have an issue with the size of my print request.
I send a POST http request because I know that the spec parameter can be
really big (I have a custom parameter CQL_FILTER to filter some layers to
print). The POST request is well sent with "/geoserver/pdf/create.json".
When I check the generated PDF, I get an empty map with the following error
near the zone of the map : "Error java.io.IOException : Error (status=414)
while reading the image from http://.......(the rest of the big url)...".
When I check the log file of GeoServer, I see the same error : "ERROR
[print.PDFUtils] - Server returned an error for http://.....(the rest of the
big url)... : Request-URI Too Large"
I understand the error, URI too long, but why my POST request is finally
converted in GET request to retrieve the image of my report ? Why doesn't it
stay in POST request ? Do I have to configure something in the print plugin
?
Any help appreciated.
Kind regards,
JCB