/** * Checks if this factory can create a parser for the potential responses of the given WFS * request. * <p> * For instance, this factory can create a parser as long as the request is a * {@link GetFeatureType GetFeature} request and the request output format matches {@code * "text/xml; subtype=gml/3.1.1"}. * </p> * * @see WFSResponseParserFactory#canProcess(WFSOperationType, String) */ public boolean canProcess(EObject request) { if (!(request instanceof GetFeatureType)) { return false; } String outputFormat = ((GetFeatureType) request).getOutputFormat(); boolean matches = isSupportedOutputFormat(outputFormat); return matches; }
@Override public String getAttachmentFileName(Object value, Operation operation) { GetFeatureType request = (GetFeatureType) OwsUtils.parameter(operation.getParameters(), GetFeatureType.class); OgrFormat format = formats.get(request.getOutputFormat()); if (format == null) { throw new WFSException("Unknown output format " + request.getOutputFormat()); } else if (!format.singleFile || request.getQuery().size() > 1) { String outputFileName = ((QName) ((QueryType) request.getQuery().get(0)).getTypeName() .get(0)).getLocalPart(); return outputFileName + ".zip"; } else { return null; } }
/** * @see WFSGetFeatureOutputFormat#getMimeType(Object, Operation) */ public String getMimeType(Object value, Operation operation) throws ServiceException { GetFeatureType request = (GetFeatureType) OwsUtils.parameter(operation.getParameters(), GetFeatureType.class); OgrFormat format = formats.get(request.getOutputFormat()); if (format == null) { throw new WFSException("Unknown output format " + request.getOutputFormat()); } else if (format.singleFile && request.getQuery().size() <= 1) { if(format.mimeType != null) { return format.mimeType; } else { // use a default binary blob return "application/octet-stream"; } } else { return "application/zip"; } }
map.put("VERSION", "1.1.0"); map.put("REQUEST", "GetFeature"); map.put("OUTPUTFORMAT", request.getOutputFormat());
protected void write(FeatureCollectionType featureCollection, OutputStream output, Operation getFeature) throws IOException, ServiceException { GetLogType request = (GetLogType) getFeature.getParameters()[0]; GetFeatureType ftRequest = toGetFeatureType(featureCollection, request); prepare(ftRequest.getOutputFormat(), featureCollection, ftRequest); encode(output, featureCollection, ftRequest); }
OgrFormat format = formats.get(gft.getOutputFormat()); if (format == null) throw new WFSException("Unknown output format " + gft.getOutputFormat());