The requests issued to the WFS service with the
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
header are not recognized as form and parsed as XML resulting in a failure.
Answer is:
<ows:Exception exceptionCode="NoApplicableCode">
<ows:ExceptionText>org.xmlpull.v1.XmlPullParserException: only whitespace content allowed before start tag and not s (position: START_DOCUMENT seen s... @1:1)
only whitespace content allowed before start tag and not s (position: START_DOCUMENT seen s... @1:1) </ows:ExceptionText>
</ows:Exception>
CURL: example to reproduce:
curl "http://192.168.1.69/geoserver/_namespace_/ows" -H "Authorization: Basic _encodedcredentials_" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" -H "Accept-Language: it-IT,it;q=0.8,en-US;q=0.5,en;q=0.3" -H "Content-Type: application/x-www-form-urlencoded; charset=UTF-8" --data "startindex=0^&maxfeatures=30^&service=WFS^&version=1.1.0^&request=GetFeature^&typeName=my_typename^&outputFormat=application%2Fjson^&sortBy=column_sort^&cql_filter=GCID%3D20^&srsName=EPSG%3A900913" -v
NOTE: due to my Windows setup I had to escape “&” with “^” to make it work.
This bug was not present in GeoServer 2.4.8
A working request in the following
curl "http://192.168.1.69/geoserver/_namespace_/ows" -H "Authorization: Basic _encodedcredentials_" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" -H "Accept-Language: it-IT,it;q=0.8,en-US;q=0.5,en;q=0.3" -H "Content-Type: application/x-www-form-urlencoded" --data "startindex=0^&maxfeatures=30^&service=WFS^&version=1.1.0^&request=GetFeature^&typeName=my_typename^&outputFormat=application%2Fjson^&sortBy=column_sort^&cql_filter=GCID%3D20^&srsName=EPSG%3A900913" -v
The only difference is in the Content-Type header, without the charset.
After a little investigation with Andrea, I suspect this issue is related to a change in the returned value of the getContentType() method in HttpServletRequest class.
(https://github.com/geoserver/geoserver/blob/2.4.8/src/ows/src/main/java/org/geoserver/ows/Dispatcher.java#L315)
|