Hi
Long time since I have been here now, and I am sorry that I have come
back to complain a bit.
We just upgraded our server with geoserver 1.4rc3.
It seems that the POST functionality has been broken again.
There is a dispatcher servlet in front that decides which service to
use, and that decides whether it should use the POST or GET method.
The problem is that when you POST the dispatcher do not check the
content-type http header to check what it is actually getting.
It do now, as it used to do, consider all POST's as data streams.
Meaning that it thinks the request body only contain xml input.
That is an incorrect assumption.
Consider the html form:
<form action="http://localhost/geoserver/wms" method="get">
<input name="bbox" value="593036.1,6604888.0,753648.25,6787297.5"/>
<input name="layers" value="topp:hordaland"/>
<input name="Format" value="image/png"/>
<input name="request" value="GetMap"/>
<input name="width" value="420"/>
<input name="height" value="477"/>
<input name="SRS" value="EPSG:32632"/>
<input name="SLD_BODY" value="[LOADS OF XML]"/>
</form>
The above form submit works fine if the sld xml is not too large.
If it gets too large you need to POST it in the request body instead of
as url parameters. In the browser this is simple:
<form action="http://localhost/geoserver/wms" method="post">
...
same parameters as above
...
</form>
This is posted and the sld xml can be as large as it needs to. However
this POST do not work, even when it got the exact same parameters as the
GET form.
The problem is that the dispatcher only checks if the method is post or
get, but do not consider the content type. The browser submits a form
with the content type: application/x-www-form-urlencoded
If this content type is received it is a parametrized post, meaning that
request.getParameter("Format") will work on both submits, get and post.
However, the request.getQueryString() do not work when it is posted, as
there is no query.
When the above code is posted the dispatcher creates a temporary file on
the disk, which the system thinks is pure xml: wfsdispatch4947686tmp
This file contains:
bbox=593036.1%2C6604888.0%2C753648.25%2C6787297.5&layers=topp%3Ahordaland&Format=image%2Fpng&request=GetMap&width=420&height=477&srs=EPSG%3A32632&SLD_BODY=[LOADS
OF XML]
Which in fact is what has been posted, and not the xml itself. This
because the dispatcher takes the request stream and just pipe it through
to the temporary file.
I know that geoserver supports to stream xml directly in the body of the
request. The content type is then not
"application/x-www-form-urlencoded", but rather "text/xml". When
text/xml content type is received it should be fine to stream the
content directly in. However if the content type is
application/x-www-form-urlencoded then it is safe to pass it on to the
doGet method as long as you do not use request.getQueryString();
This is what I did my fix for the geoserver 1.3 release. To differ
between form submits and "data" submits.
I can fix this myself, but I am unsure if I got commiter access anymore.
Or maybe this has been a political decision that I am unaware of?
Best
Magne