use of org.geotoolkit.wfs.xml.GetFeature in project geotoolkit by Geomatys.
the class AbstractGetFeature method getResponseStream.
/**
* {@inheritDoc }
*/
@Override
public InputStream getResponseStream() throws IOException {
final List<QName> typeNames = new ArrayList<>();
final List<String> propNames;
if (typeName != null) {
typeNames.add(typeName);
propNames = preparePropertyNames(typeName.getPrefix(), typeName.getNamespaceURI()).collect(Collectors.toList());
} else {
propNames = preparePropertyNames(null, null).collect(Collectors.toList());
}
final XMLFilter xmlFilter = prepareFilter().orElse(null);
final Query query = WFSXmlFactory.buildQuery(version.getCode(), xmlFilter, typeNames, null, null, null, propNames);
final GetFeature request = WFSXmlFactory.buildGetFeature(version.getCode(), "WFS", null, null, maxFeatures, query, ResultTypeType.RESULTS, outputFormat);
final URL url = new URL(serverURL);
URLConnection conec = url.openConnection();
conec = security.secure(conec);
conec.setDoOutput(true);
conec.setRequestProperty("Content-Type", "text/xml");
OutputStream stream = conec.getOutputStream();
stream = security.encrypt(stream);
try (final OutputStream toClose = stream) {
Marshaller marshaller = WFSMarshallerPool.getInstance(version).acquireMarshaller();
marshaller.marshal(request, stream);
WFSMarshallerPool.getInstance().recycle(marshaller);
} catch (JAXBException ex) {
throw new IOException(ex);
}
return security.decrypt(conec.getInputStream());
}
Aggregations