public void onRequest() { ResourceStreamRequestHandler handler = new ResourceStreamRequestHandler(getResourceStream(), getFileName()) { @Override public void respond(IRequestCycle requestCycle) { super.respond(requestCycle); model.setObject(Boolean.FALSE); } }; handler.setContentDisposition(ContentDisposition.ATTACHMENT); getComponent().getRequestCycle().scheduleRequestHandlerAfterCurrent(handler); }
@Override public void onRequest() { ResourceStreamRequestHandler handler = new ResourceStreamRequestHandler( new AbstractResourceStreamWriter() { private static final long serialVersionUID = -4234161758492585332L; @Override public void write(OutputStream output) throws IOException { escrever(output); } }, getNomeArquivo()); handler.setFileName(getNomeArquivo()); handler.setContentDisposition(ContentDisposition.ATTACHMENT); if (antiCache) { handler.setCacheDuration(Duration.NONE); } getComponent().getRequestCycle().scheduleRequestHandlerAfterCurrent(handler); }