Hi xwiki-users,
I'm trying to create a plugin to dynamically create a download link for a SH
or BAT file, and am wondering if I could get some ideas from people on the
list. What I'm trying to do is the following:
{{shell-script name="fixed_income.sh" display="true"
type="sh"}}
#!/bin/sh
# Startup the bond server
${APP_DIR}/fi/ust/bond_server -conf=fi_ust_prod.xml&
# Startup the pricing server
${APP_DIR}/fi/ust/pricing_server -conf=fi_ust_prod.xml -region=ny&
# Startup the risk analysis tool
${APP_DIR}/fi/ust/risk_analysis -days=365&
{{/shell-script}}
I don't want the server to actually "execute" this (that's easy to do),
but
rather to dynamically create an output stream and pipe it to the user's
browser. The user will then be able to save the fixed_income.sh file in
his/her own local directory to execute it.
I know this can be easily done with attachments, but I want to be able to
display the contents of this file on the wiki (possibly in a <div> that's
initially hidden), and also be able to edit this file "on the fly" without
having to create locally/save locally/upload every time (kind of like a
temporary attachment which disappears together with the {{shell-script /}}
tag). I could also just create another servlet that takes in a single
base64 encoded parameter to reconstruct the shell script, but that's not a
clean solution imho. Any other way (perhaps via Javascript) of doing this
cleanly within Xwiki space? Thanks in advance (and also for another
successful release :-D)!