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 Link<Alarm> implements IResourceListener {
private IResource resource;
AlarmLink(String id, final IModel<Alarm> 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: [email protected]
For additional commands, e-mail: [email protected]