If I got it correct, you want make user able to upload the content to the site. Content would be visble to user in some website (may be same website also).
My suggestions
1. Security
- To avoid cross site script don't allow javascript in uploading HTML. You have to parse the whole stream for it ans strip off unwanted tag and javascript code.
- Don't allow user to use iframe or layer which allows to show other sites conatent in your site.
- Put the file in the place where it would not be accessible directly. Like DB or outside context folder or inside web-inf. But in case if you want access through iframe, it must be accessible from browser. See second point for iframe solution. This is to prevent user to upload JSP and execute it.
2. For effeciency
- To increase the seconday memory uitilization compress the file at server side. In this case you have to decompress the file to server it back.
- To increase the serving time you can keep the file in file system and include it at server end in case file.
- Iframe is good solution only in case uploaded file is somehow accessible directly from browser. You can create a
servlet like "getContentFile.do?fileKey=abcshsajsd" to access the uploaded file from anywhere.