|
|
|
|
@ -11,6 +11,7 @@ import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
import org.springframework.web.servlet.view.AbstractView;
|
|
|
|
|
|
|
|
|
|
import cokr.xit.foundation.Assert;
|
|
|
|
|
import cokr.xit.foundation.Log;
|
|
|
|
|
import cokr.xit.foundation.data.DataObject;
|
|
|
|
|
import net.sf.jasperreports.engine.JRDataSource;
|
|
|
|
|
import net.sf.jasperreports.engine.JREmptyDataSource;
|
|
|
|
|
@ -81,6 +82,8 @@ public class JasperView extends AbstractView {
|
|
|
|
|
exporter.exportReport();
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
throw Assert.runtimeException(e);
|
|
|
|
|
} finally {
|
|
|
|
|
close((Iterable<InputStream>)model.get("closables"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -90,4 +93,18 @@ public class JasperView extends AbstractView {
|
|
|
|
|
String path = url.toString();
|
|
|
|
|
return !path.endsWith("/") ? path : path.substring(0, path.length() - 1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void close(Iterable<InputStream> inputStreams) {
|
|
|
|
|
if (inputStreams == null) return;
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
for (InputStream inputStream: inputStreams) {
|
|
|
|
|
if (inputStream != null)
|
|
|
|
|
inputStream.close();
|
|
|
|
|
}
|
|
|
|
|
Log.get(JasperView.class).debug("InputStreams closed");
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
throw Assert.runtimeException(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|