Issue Type: Improvement Improvement
Affects Versions: 2.2-beta2
Assignee: Andrea Aime
Components: WFS
Created: 13/Jun/12 10:53 AM
Description:

When issuing a wfs request for a layer set up with a sqlview, the viewParams are not respected. Get requests however do respect them.

To reproduce, I loaded the states shape file in the geoserver release data dir into a postgis database (table called states). Then I created a geoserver sqlview for that layer. I named it "viewstates" in a workspace called "wfstesting", and this is the sql I'm using for the sqlview:
select state_name, persons from states where persons < %limit% order by state_name

I used a default limit of 1000000 (1 million)

Get requests are honoring viewParams correctly:
curl -X GET 'http://localhost:8080/geoserver/ows?request=getfeature&service=wfs&typeName=wfstesting:viewstates&viewParams=limit:500000'

Post requests however, are not. This is the xml I'm using (note the viewParams):
<wfs:GetFeature service="WFS" version="1.0.0"
xmlns:wfs="http://www.opengis.net/wfs"
xmlns:ogc="http://www.opengis.net/ogc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
wfs:viewParams="limit:100"
xsi:schemaLocation="http://www.opengis.net/wfs
http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd">
<wfs:Query typeName="wfstesting:viewstates">
</wfs:Query>
</wfs:GetFeature>

And to test with curl (I put the xml in a file called "body"):
curl -X POST --data @body -H 'Content-Type: form-data/multipart' 'http://localhost:8080/geoserver/ows'

I understand that the xml is generated separately, and viewParams is not part of a spec. Is there a workaround to get post requests to respect it?

I tried appending the parameter to the url, but it isn't respected there either:
curl -X POST --data @body -H 'Content-Type: form-data/multipart' 'http://localhost:8080/geoserver/ows?viewParams=limit:500000'

Glancing at the code, it looks like first the request parameters are tried, and then reading the body is attempted:
https://github.com/geoserver/geoserver/blob/14e255e56b857823bc9abc67166ce8cd994ab83f/src/ows/src/main/java/org/geoserver/ows/Dispatcher.java#L619

So if it reads the request from the body, none of the request parameters are used (and if only viewParams is specified an exception is thrown during their processing anyway). That looks like it explains why the viewParams from the url are not being used.

Project: GeoServer
Priority: Major Major
Reporter: Robert Marianski
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Geoserver-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

Reply via email to