for (int i = 0; i < results.getFeature().size(); i++) {
//FeatureResults features = (FeatureResults) f.next();
SimpleFeatureCollection features = (SimpleFeatureCollection) results.getFeature().get(i);
SimpleFeatureType featureType = features.getSchema();
ResourceInfo meta = catalog.getResourceByName(featureType.getName(), ResourceInfo.class);
String prefix = meta.getNamespace().getPrefix();
String uri = meta.getNamespace().getURI();
ftNames.declareNamespace(features.getSchema(), prefix, uri);
if (ftNamespaces.containsKey(uri)) {
String location = (String) ftNamespaces.get(uri);
ftNamespaces.put(uri, location + "," + urlEncode(meta.getPrefixedName()));
} else {
// don't blindly assume it's a feature type, this class is used also by WMS FeatureInfo
// meaning it might be a coverage or a remote wms layer
if(meta instanceof FeatureTypeInfo) {
String location = typeSchemaLocation(geoServer.getGlobal(), (FeatureTypeInfo) meta, request.getBaseUrl());
ftNamespaces.put(uri, location);
}
}
//JD: wfs reprojection: should not set srs form metadata but from
// the request
//srs = Integer.parseInt(meta.getSRS());
QueryType query = (QueryType) request.getQuery().get(i);
try {
String srsName = query.getSrsName() != null ? query.getSrsName().toString() : null;
if ( srsName == null ) {
//no SRS in query...asking for the default?
srsName = meta.getSRS();
}
if ( srsName != null ) {
CoordinateReferenceSystem crs = CRS.decode(srsName);
String epsgCode = GML2EncodingUtils.epsgCode(crs);
srs = Integer.parseInt(epsgCode);