Skip to content

Commit

Permalink
Merge pull request #191 from occamlabs/3.3-fix-wfs-getfeature-respons…
Browse files Browse the repository at this point in the history
…e-xsi-schemalocation

deegree-services-wfs: Fix incomplete xsi:schemaLocation attributes in WFS 1.0.0/1.1.0 GetFeature response documents
  • Loading branch information
MrSnyder committed Dec 3, 2013
2 parents 40b2978 + 18df0ad commit ed3de69
Showing 1 changed file with 21 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
import org.deegree.gml.GMLStreamWriter;
import org.deegree.gml.GMLVersion;
import org.deegree.gml.reference.GmlXlinkOptions;
import org.deegree.protocol.wfs.describefeaturetype.DescribeFeatureType;
import org.deegree.protocol.wfs.getfeature.TypeName;
import org.deegree.services.controller.OGCFrontController;
import org.deegree.services.i18n.Messages;
Expand All @@ -101,11 +102,14 @@
import org.slf4j.LoggerFactory;

/**
*
* Handles {@link DescribeFeatureType} requests for the {@link GmlFormat}.
*
* @see GmlFormat
*
* @author <a href="mailto:schneider@occamlabs.de">Markus Schneider</a>
* @author <a href="mailto:schmitz@lat-lon.de">Andreas Schmitz</a>
* @author last edited by: $Author$
*
* @version $Revision$, $Date$
*
* @since 3.2
*/
abstract class AbstractGmlRequestHandler {

Expand Down Expand Up @@ -228,7 +232,7 @@ protected void writeMemberFeature( Feature member, GMLStreamWriter gmlStream, XM
* <li>WFS 2.0.0: GetFeature request using stored query (urn:ogc:def:query:OGC-WFS::GetFeatureById)</li>
* </ul>
* </p>
*
*
* @param version
* WFS protocol version, must not be <code>null</code>
* @param gmlVersion
Expand Down Expand Up @@ -266,7 +270,7 @@ protected String getObjectXlinkTemplate( Version version, GMLVersion gmlVersion

/**
* Returns the value for the <code>xsi:schemaLocation</code> attribute in the response document.
*
*
* @param requestVersion
* requested WFS version, must not be <code>null</code>
* @param requestedFts
Expand All @@ -289,19 +293,23 @@ protected String getSchemaLocation( Version requestVersion, Collection<FeatureTy

private String getSchemaLocationForWfs100( Collection<FeatureType> requestedFts ) {
GMLVersion gmlVersion = options.getGmlVersion();
String schemaLocation = null;
if ( GML_2 == gmlVersion ) {
return WFS_NS + " " + WFS_100_BASIC_SCHEMA_URL;
schemaLocation = WFS_NS + " " + WFS_100_BASIC_SCHEMA_URL;
} else {
schemaLocation = getSchemaLocation( VERSION_100, gmlVersion, WFS_FEATURECOLLECTION_NAME );
}
String schemaLocation = getSchemaLocation( VERSION_100, gmlVersion, WFS_FEATURECOLLECTION_NAME );
return schemaLocation + " " + getSchemaLocationPartForFeatureTypes( VERSION_100, gmlVersion, requestedFts );
}

private String getSchemaLocationForWfs110( Collection<FeatureType> requestedFts ) {
GMLVersion gmlVersion = options.getGmlVersion();
String schemaLocation = null;
if ( GML_31 == gmlVersion ) {
return WFS_NS + " " + WFS_110_SCHEMA_URL;
schemaLocation = WFS_NS + " " + WFS_110_SCHEMA_URL;
} else {
schemaLocation = getSchemaLocation( VERSION_110, gmlVersion, WFS_FEATURECOLLECTION_NAME );
}
String schemaLocation = getSchemaLocation( VERSION_110, gmlVersion, WFS_FEATURECOLLECTION_NAME );
return schemaLocation + " " + getSchemaLocationPartForFeatureTypes( VERSION_110, gmlVersion, requestedFts );
}

Expand Down Expand Up @@ -421,7 +429,7 @@ protected DateTime getCurrentDateTimeWithoutMilliseconds() {
/**
* Returns the value for the 'xsi:schemaLocation' attribute to be included in a <code>GetGmlObject</code> or
* <code>GetFeature</code> response.
*
*
* @param version
* WFS protocol version, must not be <code>null</code>
* @param gmlVersion
Expand All @@ -440,9 +448,9 @@ protected String getSchemaLocation( Version version, GMLVersion gmlVersion, QNam
baseUrl.append( "&REQUEST=DescribeFeatureType&OUTPUTFORMAT=" );

try {
if ( VERSION_100.equals( version ) && gmlVersion == GMLVersion.GML_2 ) {
if ( VERSION_100.equals( version ) && gmlVersion == GML_2 ) {
baseUrl.append( "XMLSCHEMA" );
} else if ( VERSION_200.equals( version ) && gmlVersion == GMLVersion.GML_32 ) {
} else if ( VERSION_200.equals( version ) && gmlVersion == GML_32 ) {
baseUrl.append( URLEncoder.encode( gmlVersion.getMimeType(), "UTF-8" ) );
} else {
baseUrl.append( URLEncoder.encode( gmlVersion.getMimeTypeOldStyle(), "UTF-8" ) );
Expand Down

0 comments on commit ed3de69

Please sign in to comment.