if (request.isSOAP() && (handler instanceof OWS10ServiceExceptionHandler || handler instanceof OWS11ServiceExceptionHandler)) {
request.setOperation(operation); if (request.isSOAP()) {
protected void write( FeatureTypeInfo[] featureTypeInfos, OutputStream output, Operation describeFeatureType) throws IOException { // hack for SOAP request, when encoding as SOAP response the schema is actually required // to be encoded in base64 if (Dispatcher.REQUEST.get() != null && Dispatcher.REQUEST.get().isSOAP()) { output.write( ("<wfs:DescribeFeatureTypeResponse xmlns:wfs='" + getWFSNamespaceURI() + "'>") .getBytes()); ByteArrayOutputStream bout = new ByteArrayOutputStream(); doWrite(featureTypeInfos, bout, describeFeatureType); output.write(Base64.encodeBase64(bout.toByteArray())); output.write("</wfs:DescribeFeatureTypeResponse>".getBytes()); } else { // normal write doWrite(featureTypeInfos, output, describeFeatureType); } }
@Override public void write(Object value, OutputStream output, Operation operation) throws IOException, ServiceException { Encoder encoder = new Encoder(new WFSConfiguration()); encoder.setEncoding(Charset.forName(getInfo().getGeoServer().getSettings().getCharset())); encoder.setOmitXMLDeclaration(Dispatcher.REQUEST.get().isSOAP()); String baseURL = (String) EMFUtils.get((EObject) operation.getParameters()[0], "baseUrl"); encoder.setSchemaLocation(WFS.NAMESPACE, buildSchemaURL(baseURL, "wfs/2.0/wfs.xsd")); encode(encoder, value, output, operation); }
Request dispatcherRequest = Dispatcher.REQUEST.get(); if (dispatcherRequest != null) { encoder.setOmitXMLDeclaration(dispatcherRequest.isSOAP());