Hi all.
First of all, I tried to find some example into showcase or forum, but no success.
here is discussion about image file download and upload :
http://<br /> http://forums.smartcl...download<br />
but I think my case a little bit different.
I have http URL for file into my client code like that :
http://someipaddress:port/catalog/catalog/fileName.mp3
how i can download this by clicking (for example) button ?
1.onclick event:
2. getting url from server :
Regards,
Paata Lominadze.
First of all, I tried to find some example into showcase or forum, but no success.
here is discussion about image file download and upload :
http://<br /> http://forums.smartcl...download<br />
but I think my case a little bit different.
I have http URL for file into my client code like that :
http://someipaddress:port/catalog/catalog/fileName.mp3
how i can download this by clicking (for example) button ?
1.onclick event:
Code:
saveFileButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() {
@Override
public void onClick(com.smartgwt.client.widgets.events.ClickEvent event) {
try {
ListGridRecord listGridRecord = sessionsGrid.getSelectedRecord();
if (listGridRecord == null) {
SC.say("Please Select Record Into Grid.");
return;
}
String sessionId = listGridRecord.getAttributeAsString("session_id");
Date date = listGridRecord.getAttributeAsDate("start_date");
getURL(sessionId, date);
} catch (Exception e) {
SC.say(e.toString());
}
}
});
Code:
private void getURL(String sessionId, Date date) {
try {
CallCenter.commonService.findSessionMp3ById(sessionId, date, new AsyncCallback<String>() {
@Override
public void onSuccess(String urlAddress) {
if (urlAddress == null || urlAddress.trim().equals("")) {
SC.say("Can't find url by sessionId : "+urlAddress);
return;
}
//////////////////////////////////////////////////////////////
// HERE I WANT TO DOWNLOAD FILE BY URL
/////////////////////////////////////////////////////////////
}
@Override
public void onFailure(Throwable caught) {
SC.say(caught.toString());
}
});
} catch (Exception e) {
SC.say(e.toString());
}
}
Regards,
Paata Lominadze.
Comment