I'm tasked with building a website that performs the following basic functions: 1. Allow the user to create/modify some data in a file on the filesystem. 2. At the user's request, perform some action (transparent to the user), that may be a shell script, standalone java prog, or a shell script that executes a java program, on that file. 3. Immediately following, email the result based on parameters supplied by the user at request time.
Can anyone kind of point me in the right direction of how to do this architectually? Particularly - how should i store these files so that they are not available via http on the site, but so that the web user cannot have access tot eh rest of the system. And, what is the best way to have a web app kick off a standalone program, and be able to respond to it's result?
I think that was a probe to see if this is homework
How you make flat files inaccessible to your HTTP server may depend on your web server or OS permissions structures. I'll let somebody else jump in there. BTW: What are your HTTP server and OS?
To run an arbitrary OS command is not trivial. Use Runtime.exec() to run another process. On Windows you have to worry about whether you need to start CMD.EXE or COMMAND.EXE or not. Set up streams to read the stdout and errout from the command or the command may hang. Any output is probably interesting anyhow.
To mail the results, I haven't used the JavaMail APIs but google for them ... they're out there and they're not too hard.
Ok, I maybe scored on one out of three. Hope that helps!
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Joined: Dec 14, 2004
Homework? nah. More like promising a client results before really scoping out the project. Im running JRun4 on Suse 9.1 (also steepening my learning curve, but im doin' ok). The external process is actually going to be an XSLT transform. I guess I could use xalan as part of the web app, but would that be bad design? Bad performance?