Hi, I would like to map my velocity URL to a file that is served by an action, much like LicenseDownload.vm: please click <A HREF="download.action?serialNumber=$serialNumber">here</A> to download the license file action.xml: <action name="com.scancoin.license.action.DownloadAction" alias="download"> <view name="success">/templates/GoodbyeSuccess.vm</view> <view name="input">/templates/LicenseDownload.vm</view> </action>
DownloadAction: //now, manipulate the output to stream a file. HttpServletResponse res = ServletActionContext.getResponse(); OutputStream out = res.getOutputStream(); //String fileName = req.getParameter("fileName"); res.setContentType("application/lic"); StringBufferInputStream in = new StringBufferInputStream(lData.getEncryptedData()); int i; while ((i = in.read()) != -1) { out.write(i); } in.close(); out.close(); return SUCCESS; I get a download window, but I would like to give the serialNumber as the link in LicenseDOwnload.vm in order to name the downloaded file. Is there an easy way to do that? Thanks /peter ########################################### This message has been scanned by F-Secure Anti-Virus for Microsoft Exchange. For more information, connect to http://www.F-Secure.com/Title: Url to download binary data?
Hi,
I would like to map my velocity URL to a file that is served by an action, much like
LicenseDownload.vm:
please click <A HREF="" to download the license file
action.xml:
<action name="com.scancoin.license.action.DownloadAction" alias="download">
<view name="success">/templates/GoodbyeSuccess.vm</view>
<view name="input">/templates/LicenseDownload.vm</view>
</action>
DownloadAction:
//now, manipulate the output to stream a file.
HttpServletResponse res = ServletActionContext.getResponse();
OutputStream out = res.getOutputStream();
//String fileName = req.getParameter("fileName");
res.setContentType("application/lic");
StringBufferInputStream in =
new StringBufferInputStream(lData.getEncryptedData());
int i;
while ((i = in.read()) != -1)
{
out.write(i);
}
in.close();
out.close();
return SUCCESS;
I get a download window, but I would like to give the serialNumber as the link in LicenseDOwnload.vm
in order to name the downloaded file. Is there an easy way to do that?
Thanks
/peter
###########################################
This message has been scanned by F-Secure Anti-Virus for Microsoft Exchange.
For more information, connect to http://www.F-Secure.com/