I was doing some testing with WFS GetFeature requests, and ran into some
rather startling behaviour.
First of all, omitting the "service=wfs" parameter from a KVP-encoded
request generally works just fine, as long as you are using the WFS virtual
service endpoint. However, sometimes it doesn't. All testing is done with a
GeoServer 2.10.2 installation with no extensions:
*With service=wfs:*
http://localhost:8080/geoserver/wfs?service=wfs&request=GetFeature&typenames=sf:roads&version=2.0.0
returns all property values for all features in sf:roads
http://localhost:8080/geoserver/wfs?service=wfs&request=GetFeature&typenames=sf:roads&version=2.0.0&propertyname=
returns all property values for all features in sf:roads
http://localhost:8080/geoserver/wfs?service=wfs&request=GetFeature&typenames=sf:roads&version=2.0.0&propertyname=*
returns all property values for all features in sf:roads
http://localhost:8080/geoserver/wfs?service=wfs&request=GetFeature&typenames=sf:roads&version=2.0.0&propertyname=cat
returns all values for cat property for all features in sf:roads
http://localhost:8080/geoserver/wfs?service=wfs&request=GetFeature&typenames=sf:roads&version=2.0.0&propertyname=cat,label
returns all values for cat and label properties for all features in sf:roads
*Without service=wfs:*
http://localhost:8080/geoserver/wfs?request=GetFeature&typenames=sf:roads&version=2.0.0
returns all property values for all features in sf:roads
http://localhost:8080/geoserver/wfs?request=GetFeature&typenames=sf:roads&version=2.0.0&propertyname=
<ows:Exception exceptionCode="NoApplicableCode">
<ows:ExceptionText>java.lang.NullPointerException</ows:ExceptionText>
</ows:Exception>
http://localhost:8080/geoserver/wfs?request=GetFeature&typenames=sf:roads&version=2.0.0&propertyname=*
<ows:Exception exceptionCode="NoApplicableCode">
<ows:ExceptionText>java.lang.NullPointerException</ows:ExceptionText>
</ows:Exception>
http://localhost:8080/geoserver/wfs?request=GetFeature&typenames=sf:roads&version=2.0.0&propertyname=cat
<ows:Exception exceptionCode="NoApplicableCode">
<ows:ExceptionText>
java.lang.ClassCastException: java.lang.String cannot be cast to
java.util.Collection java.lang.String cannot be cast to java.util.Collection
</ows:ExceptionText>
</ows:Exception>
http://localhost:8080/geoserver/wfs?request=GetFeature&typenames=sf:roads&version=2.0.0&propertyname=cat,label
<ows:Exception exceptionCode="NoApplicableCode">
<ows:ExceptionText>
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 Index: 0, Size: 0
</ows:ExceptionText>
</ows:Exception>
Given that all of the above is not actually valid according to the WFS 2.0
specification (the propertyname parameter is not part of the 2.0 spec),
this is slightly less problematic. However since we still provide this
functionality, some amount of consistency would be good.
Given the errors observed when service=wfs is omitted, it might be best to
explicitly throw an error instead when service is not included in the KVP.
Does anyone else have any insight here?
Torben
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Geoserver-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-devel