private void printPageFile(HttpServletResponse response, VariablesSecureApp vars,
String strFileReference) throws IOException, ServletException {
final TabAttachmentsData[] data = TabAttachmentsData.selectEdit(this, strFileReference);
if (data == null || data.length == 0)
throw new ServletException("Missing file");
FileUtility f = new FileUtility();
// FIXME: Get the directory separator from Java runtime
final File file = new File(globalParameters.strFTPDirectory + "/" + data[0].adTableId + "-"
+ data[0].adRecordId, data[0].name);
if (file.exists())
f = new FileUtility(globalParameters.strFTPDirectory + "/" + data[0].adTableId + "-"
+ data[0].adRecordId, data[0].name, false, true);
else
f = new FileUtility(globalParameters.strFTPDirectory, strFileReference, false, true);
if (data[0].datatypeContent.equals(""))
response.setContentType("application/txt");
else
response.setContentType(data[0].datatypeContent);
response.setHeader("Content-Disposition", "attachment; filename=" + data[0].name);
f.dumpFile(response.getOutputStream());
response.getOutputStream().flush();
response.getOutputStream().close();
}