/** * Grabs the list of allowed MIME-Types for the GetMap operation from the set of {@link * GetMapOutputFormat}s registered in the application context. * * @param applicationContext The application context where to grab the GetMapOutputFormats from. * @see GetMapOutputFormat#getContentType() */ public Set<String> getAvailableMapFormatNames() { final Collection<GetMapOutputFormat> producers; producers = WMSExtensions.findMapProducers(applicationContext); final Set<String> formats = new HashSet<String>(); for (GetMapOutputFormat producer : producers) { formats.addAll(producer.getOutputFormatNames()); } return formats; }
/** @return all allowed GetMap format names */ public Set<String> getAllowedMapFormatNames() { final Collection<GetMapOutputFormat> producers; producers = WMSExtensions.findMapProducers(applicationContext); final Set<String> formats = new HashSet<String>(); for (GetMapOutputFormat producer : producers) { if (isAllowedGetMapFormat(producer) == false) { continue; // skip this producer, its mime type is not allowed } formats.addAll(producer.getOutputFormatNames()); } return formats; }
/** * Checks is a getMap mime type is allowed * * @param format * @return */ public boolean isAllowedGetMapFormat(GetMapOutputFormat format) { if (getServiceInfo().isGetMapMimeTypeCheckingEnabled() == false) return true; Set<String> mimeTypes = getServiceInfo().getGetMapMimeTypes(); return mimeTypes.contains(format.getMimeType()); }