throw new WebApplicationException(Response.status(Response.Status.NOT_FOUND)
.entity("Package [" + packageName + "] does not exist").build());
}
try {
ModuleItem moduleItem = rulesRepository.loadModule(packageName);
ModuleAssembler moduleAssembler = ModuleAssemblerManager.getModuleAssembler(moduleItem.getFormat(), moduleItem, null);
String drl = moduleAssembler.getCompiledSource();
return Response.ok(drl).header("Content-Disposition", "attachment; filename=" + packageName).
header("Last-Modified", createDateFormat().format(this.convertToGmt(moduleItem.getLastModified()).getTime())).build();
} catch (RuntimeException e) {
//catch RulesRepositoryException and other exceptions. For example when the package does not exists.
throw new WebApplicationException(e);