내가 파일을 업로드 한 파일을 다운로드 할 수 있습니다 하나 개의 요청에 의미, 수신 응답이 파일을 다운로드 할 때 가능한 한 이후에 파일을 업로드하고DWR - 하나 개의 요청에 파일 다운로드 파일을 업로드
입니다 동작?
내가 파일을 업로드 한 파일을 다운로드 할 수 있습니다 하나 개의 요청에 의미, 수신 응답이 파일을 다운로드 할 때 가능한 한 이후에 파일을 업로드하고DWR - 하나 개의 요청에 파일 다운로드 파일을 업로드
입니다 동작?
예는 적어도 DWR 3에
어쩌면이 데모 코드가 당신을 위해 도움이 될 것입니다 그렇게하는 것이 가능하다 : http://directwebremoting.org/dwr-demo/simple/download.html
클라이언트에서 다운로드 엑셀을 반환 예 :
// 자바 측 :
public FileTransfer getExcel(Parametros param){
byte[] result = <here get data>;
InputStream myInputStream = new ByteArrayInputStream(result);
String excelFormat = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
FileTransfer dwrExcelFile = new FileTransfer("excel.xlsx", excelFormat, myInputStream);
return dwrExcelFile;
}
// 자바 스크립트 측면 :
,function downloadExcelFile() {
dwr.engine.setTimeout(59000);
var params = <params_to_send>;
<Java_class>.getExcel(params, {callback:function(dataFromServer) {
downloadExcelCallback(dataFromServer);
}});
}
function downloadExcelCallback(data) {
dwr.engine.openInDownload(data);
}