IOException "ZIP entry size is too large" when downloading excel file
InputStream in = DownloadGeneratedExcelPage1.class .getResourceAsStream("/templates/excelTest.xlsm"); ByteArrayOutputStream os = new ByteArrayOutputStream(); try { XSSFWorkbook workBook = new XSSFWorkbook(in); workBook.write(os); } catch (IOException ex) { ex.printStackTrace(); } return os.toByteArray(); } @Override protected void setResponseHeaders(ResourceResponse data, Attributes attributes) { SimpleDateFormat df = new SimpleDateFormat( ".MM.dd_HHmm"); data.setFileName("testFile_" + df.format(new Date()) + ".xlsm"); data.disableCaching(); super.setResponseHeaders(data, attributes); } }; IRequestHandler handler = new ResourceRequestHandler(resource, null); getRequestCycle().scheduleRequestHandlerAfterCurrent(handler); } }); } } I would highly appreciate your feedback. Many thanks. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/IOException-ZIP-entry-size-is-too-large-when-downloading-excel-file-tp4651492.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
IOException "ZIP entry size is too large" when downloading excel file
nloadGeneratedExcelPage1.class .getResourceAsStream("/templates/excelTest.xlsm"); ByteArrayOutputStream os = new ByteArrayOutputStream(); try { XSSFWorkbook workBook = new XSSFWorkbook(in); workBook.write(os); } catch (IOException ex) { ex.printStackTrace(); } return os.toByteArray(); } @Override protected void setResponseHeaders(ResourceResponse data, Attributes attributes) { SimpleDateFormat df = new SimpleDateFormat( ".MM.dd_HHmm"); data.setFileName("testFile_" + df.format(new Date()) + ".xlsm"); data.disableCaching(); super.setResponseHeaders(data, attributes); } }; IRequestHandler handler = new ResourceRequestHandler(resource, null); getRequestCycle().scheduleRequestHandlerAfterCurrent(handler); } }); } } I would highly appreciate your feedback. Many thanks. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/IOException-ZIP-entry-size-is-too-large-when-downloading-excel-file-tp4651487.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: IOException "ZIP entry size is too large" when downloading excel file
eneratedExcelPage1 extends WebPage { >private static final long serialVersionUID = 1L; >public DownloadGeneratedExcelPage1() { >add(new Link("download") { >private static final long serialVersionUID = 1L; > >@Override >public void onClick() { >final IResource resource = new > ByteArrayResource( >"application/vnd.ms-excel") > { >private static final long > serialVersionUID = 1L; > >@Override >protected byte[] getData(Attributes > attributes) { >InputStream in = > DownloadGeneratedExcelPage1.class > > .getResourceAsStream("/templates/excelTest.xlsm"); >ByteArrayOutputStream os = > new ByteArrayOutputStream(); >try { >XSSFWorkbook > workBook = new XSSFWorkbook(in); >workBook.write(os); >} catch (IOException ex) { > > ex.printStackTrace(); >} >return os.toByteArray(); >} > >@Override >protected void > setResponseHeaders(ResourceResponse data, >Attributes > attributes) { >SimpleDateFormat df = new > SimpleDateFormat( > > ".MM.dd_HHmm"); >data.setFileName("testFile_" >+ > df.format(new Date()) + ".xlsm"); >data.disableCaching(); > > super.setResponseHeaders(data, attributes); > } >}; >IRequestHandler handler = new > ResourceRequestHandler(resource, >null); > > getRequestCycle().scheduleRequestHandlerAfterCurrent(handler); >} >}); >} > } > > I would highly appreciate your feedback. Many thanks. > > > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/IOException-ZIP-entry-size-is-too-large-when-downloading-excel-file-tp4651492.html > Sent from the Users forum mailing list archive at Nabble.com. > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: IOException "ZIP entry size is too large" when downloading excel file
Thank Francois, As mentioned earlier, exactly same piece of code when run on its own works. However, it throws IOException when I plug the same in my wicket application with spring/hibernate/mysql. The only difference between two setups is spring/hibernate and the following two lines from exception description mention spring at org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:113) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) thanks. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/IOException-ZIP-entry-size-is-too-large-when-downloading-excel-file-tp4651492p4651495.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org