In version 1.0.* one could set an attribute as 'mandatory', ensuring that it was returned every time. This is a bit hacky, in an ideal world one should be able to just set the schema to minOccurs=1 and it will automatically return. But the geotools gml parser needs to get a lot better first. So until then we will just set it in the info.xml file for featureTypes. This should fit in nicely with the newly added 'exposed' attributes, where one can specify which attributes to expose. We will just add an attribute mandatory="true".
As for coding this, unfortunately geotools doesn't support the mandatory concept. So for now we can hack it in to geoserver, and just add it to the query request. We may be able to wrap the schema to do it a bit more elegantly.
This functionality is needed to pass cite tests, getFeature #4
CodeHaus Comment From: cholmes - Time: Mon, 5 Jan 2004 21:05:04 -0600
<p>Fixed, though it's hackier than I'd like. Geotools needs better handling of property names. see <a href="https://jira.codehaus.org/browse/GEOS-79" title="Tests and TestSuites are not appearing the GUI" class="issue-link" data-issue-key="GEOS-79"><del>GEOS-79</del></a>. But this should work well enough to pass cite tests. It just will return things in the wrong order if not requested in the right order.</p>