10-21-2011 07:40 AM
<webscript>
<shortname>Create text file</shortname>
<description>some text</description>
<url>/abc/createtxtfile</url>
<format default="text">extension</format>
<authentication>user</authentication>
</webscript>
public void execute(WebScriptRequest request, WebScriptResponse response){
String filename = "C:\\temp\\myFile.txt";
response.setContentType("text/plain");
String disHeader = "Attachment;
Filename=\"myFile.txt\"";
response.setHeader("Content-Disposition", disHeader);
File fileToDownload = new File(filename);
FileInputStream fileInputStream = new FileInputStream(fileToDownload);
int i;
while ((i=fileInputStream.read())!=-1)
{
out.write(i);
}
fileInputStream.close();
out.close();
}
successcallback:{
fn: fnSuccess
scope: this
}
var fnSuccess = function onSuccess(){
//doing nothing right now…
}
10-27-2011 10:21 AM
response.setHeader("Content-Disposition","attachment;filename=\"" + filename + "\"");
Hope this helps.
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.