private boolean produceDownloadFile(Kernel kernel, Artifact configId, HttpServletResponse response, boolean reply) throws IOException {
//todo: replace kernel mumbo jumbo with JSR-77 navigation
// Step 1: check if it's in a configuration store
ConfigurationManager mgr = ConfigurationUtil.getConfigurationManager(kernel);
if(mgr.isConfiguration(configId)) {
ConfigurationStore store = mgr.getStoreForConfiguration(configId);
response.setContentType("application/zip");
if(!reply) {
return true;
}
try {
store.exportConfiguration(configId, response.getOutputStream());
return true;
} catch (NoSuchConfigException e) {
log.error("Inconsistent ConfigurationStore data; ConfigManager claims it has configuration "+configId+" but store claims it doesn't",e);
throw new IOException("Unable to write ZIP file; see server log for details");
}