/** * Set download data. * @param file * @param contentType * @return the download id * @throws DownloadException */ public static long setDownload( final File file, final String contentType) throws DownloadException { return setDownload(file, contentType, null); }
/** * Set download data. * @param file * @param contentType * @param contentDisposition * @return the download id * @throws DownloadException */ public static long setDownload( final File file, final String contentType, final String contentDisposition) throws DownloadException { return setDownload(getBytesFromFile(file), file.getName(), contentType, contentDisposition); }
try { long id = System.currentTimeMillis(); setDownloadAttribute(DownloadServlet.DATA_ATTRIBUTE + id, bytes); if (contentType != null) { setDownloadAttribute(DownloadServlet.CONTENT_TYPE_ATTRIBUTE + id, contentType); setDownloadAttribute(DownloadServlet.FILENAME_ATTRIBUTE + id, filename); setDownloadAttribute(DownloadServlet.CONTENT_DISPOSITION_ATTRIBUTE, contentDisposition);
request, getServletContext()); BeanUtilsWeb.initBeanFactory(getServletContext()); String contentType = (String) DownloadUtils.getDownloadAttribute( CONTENT_TYPE_ATTRIBUTE + id); if (contentType != null) { response.setContentType(contentType); String filename = (String) DownloadUtils.getDownloadAttribute( FILENAME_ATTRIBUTE + id); String disposition = (String) ContextUtils.getGlobalSessionAttribute( byte [] data = (byte []) DownloadUtils.getDownloadAttribute( DATA_ATTRIBUTE + id); if (data == null) {
/** * Set download data. * @param file * @param contentType * @param contentDisposition * @return the download id * @throws DownloadException */ public static long setDownload( final File file, final String contentType, final String contentDisposition) throws DownloadException { return setDownload(getBytesFromFile(file), file.getName(), contentType, contentDisposition); }
try { long id = System.currentTimeMillis(); setDownloadAttribute(DownloadServlet.DATA_ATTRIBUTE + id, bytes); if (contentType != null) { setDownloadAttribute(DownloadServlet.CONTENT_TYPE_ATTRIBUTE + id, contentType); setDownloadAttribute(DownloadServlet.FILENAME_ATTRIBUTE + id, filename); setDownloadAttribute(DownloadServlet.CONTENT_DISPOSITION_ATTRIBUTE, contentDisposition);
/** * Set download data. * @param path * @return the download id * @throws DownloadException */ public static long setDownload( final String path) throws DownloadException { return setDownload(path, null); }
/** * Set download data. * @param file * @param contentType * @param contentDisposition * @return the download id * @throws DownloadException */ public static long setDownload( final File file, final String contentType, final String contentDisposition) throws DownloadException { return setDownload(getBytesFromFile(file), file.getName(), contentType, contentDisposition); }
try { long id = System.currentTimeMillis(); setDownloadAttribute(DownloadServlet.DATA_ATTRIBUTE + id, bytes); if (contentType != null) { setDownloadAttribute(DownloadServlet.CONTENT_TYPE_ATTRIBUTE + id, contentType); setDownloadAttribute(DownloadServlet.FILENAME_ATTRIBUTE + id, filename); setDownloadAttribute(DownloadServlet.CONTENT_DISPOSITION_ATTRIBUTE, contentDisposition);
/** * Set download data. * @param bytes * @param filename * @return the download id * @throws DownloadException */ public static long setDownload( final byte [] bytes, final String filename) throws DownloadException { return setDownload(bytes, filename, null); }
/** * Set download data. * @param file * @param contentType * @return the download id * @throws DownloadException */ public static long setDownload( final File file, final String contentType) throws DownloadException { return setDownload(file, contentType, null); }
/** * Set download data. * @param file * @return the download id * @throws DownloadException */ public static long setDownload( final File file) throws DownloadException { return setDownload(file, null); }
/** * Set download data. * @param bytes * @return the download id * @throws DownloadException */ public static long setDownload( final byte [] bytes) throws DownloadException { return setDownload(bytes, null); }
/** * Set download data. * @param file * @return the download id * @throws DownloadException */ public static long setDownload( final File file) throws DownloadException { return setDownload(file, null); }
/** * Set download data. * @param path * @return the download id * @throws DownloadException */ public static long setDownload( final String path) throws DownloadException { return setDownload(path, null); }
/** * Set download data. * @param path * @param contentType * @return the download id * @throws DownloadException */ public static long setDownload( final String path, final String contentType) throws DownloadException { return setDownload(path, contentType, null); }
/** * Set download data. * @param bytes * @param filename * @return the download id * @throws DownloadException */ public static long setDownload( final byte [] bytes, final String filename) throws DownloadException { return setDownload(bytes, filename, null); }
/** * Set download data. * @param path * @param contentType * @return the download id * @throws DownloadException */ public static long setDownload( final String path, final String contentType) throws DownloadException { return setDownload(path, contentType, null); }
/** * Set download data. * @param path * @param contentType * @return the download id * @throws DownloadException */ public static long setDownload( final String path, final String contentType) throws DownloadException { return setDownload(path, contentType, null); }
/** * Set download data. * @param bytes * @return the download id * @throws DownloadException */ public static long setDownload( final byte [] bytes) throws DownloadException { return setDownload(bytes, null); }