Re: Download serves empty files with correct number of pages !?!
OK so the empty PDFs where due to some strangeness with the build config which is fixed. The filename and extensions are added by item.getModelObject().getFile(). So it works fine now however using DownloadLink the file still downloads rather than is opened in a new tab. Any ideas? -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Download-serves-empty-files-with-correct-number-of-pages-tp4670117p4670125.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: Download serves empty files with correct number of pages !?!
org.apache.wicket.request.resource.ContentDisposition ContentDisposition.INLINE ContentDisposition.ATTACHMENT resourceResponse.setContentDisposition(contentDisposition); François Le 31 mars 2015 à 13:35, ChambreNoire a...@tentelemed.com a écrit : OK so the empty PDFs where due to some strangeness with the build config which is fixed. The filename and extensions are added by item.getModelObject().getFile(). So it works fine now however using DownloadLink the file still downloads rather than is opened in a new tab. Any ideas? -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Download-serves-empty-files-with-correct-number-of-pages-tp4670117p4670125.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: Download serves empty files with correct number of pages !?!
Is there an easy way of overloading the ContentDisposition.ATTACHMENT already used in DownloadLink? -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Download-serves-empty-files-with-correct-number-of-pages-tp4670117p4670127.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: Download serves empty files with correct number of pages !?!
Francois Meillet wrote path = new ClassPathResource(descriptors/hc).getFile(); the path isn't null ? Nope. By the time we get to the line : return new FileResourceStream(new File(path, getModelObject().getFile())); the path isn't null and this ends up instantiating a FileResourceStream with a file that both has the correct path and exist()s... -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Download-serves-empty-files-with-correct-number-of-pages-tp4670117p4670121.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: Download serves empty files with correct number of pages !?!
path = new ClassPathResource(descriptors/hc).getFile(); the path isn't null ? François Le 30 mars 2015 à 18:03, ChambreNoire a...@tentelemed.com a écrit : Sure but no exception is thrown! -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Download-serves-empty-files-with-correct-number-of-pages-tp4670117p4670119.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: Download serves empty files with correct number of pages !?!
printing the exception could help } catch (IOException exception) { return null; -- print stack } François Le 30 mars 2015 à 17:44, ChambreNoire a...@tentelemed.com a écrit : Hello, I have a strange problem. Ever since I have moved the files I'm linking to in the following code to the classpath, they are downloading as empty files but *with the correct number of pages*! Any ideas? Thanks class AlarmLink extends LinkAlarm implements IResourceListener { private IResource resource; AlarmLink(String id, final IModelAlarm model) { super(id, model); resource = new ResourceStreamResource(null) { @Override protected IResourceStream getResourceStream() { File path; try { path = new ClassPathResource(descriptors/hc).getFile(); } catch (IOException exception) { return null; } return new FileResourceStream(new File(path, getModelObject().getFile())); } }; } public final void onResourceRequested() { Attributes a = new Attributes(RequestCycle.get().getRequest(), RequestCycle.get().getResponse(), null); resource.respond(a); onLinkClicked(); } @Override protected final CharSequence getURL() { return urlFor(IResourceListener.INTERFACE, null); } @Override public void onClick() {} @Override public IModel? getBody() { return PropertyModel.of(getModel(), label); } @Override protected void onComponentTag(ComponentTag tag) { super.onComponentTag(tag); tag.getAttributes().put(target, _blank); } } -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Download-serves-empty-files-with-correct-number-of-pages-tp4670117.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: Download serves empty files with correct number of pages !?!
Sure but no exception is thrown! -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Download-serves-empty-files-with-correct-number-of-pages-tp4670117p4670119.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