i got a servlet is going to connect to a DB then do some queries then write the result in excel file on the local hard disk , what i wanna instead writing the file on the local hard disk i wanna to store it on the tomcat in a specific path so it can be downloaded ,
Are there any security or authentication issues? getting the file and writing to the Tomcat server using the Tomcat server isn't difficult, if you need to restrict who sees what, than this will affect the design.
Originally posted by David O'Meara: Are there any security or authentication issues? getting the file and writing to the Tomcat server using the Tomcat server isn't difficult, if you need to restrict who sees what, than this will affect the design.
No security concerns i'll put a link in the index page to access the archived files. actually i goggled a lot but i cant find anything useful.
Personally, I'd recommend against storing the files within the body of the web application. By doing so, you create complications with upgrades and redeployment. I've done setups like this many times and I store the files independently of the web app so that I can upgrade and redeploy the web app without worrying about clobbering the files,
Access to the files is granted through a servlet that reads the files from the file system and streams them to the client upon demand.
so you recommend streaming upon demand? OK good idea but what if the client wanna access the old files? because like i mentioned before the is reporting tool. Any advice ?
My suggestion is to stream the file upon demand. If the record you're going to include in the file is likely to change, you could create a temporary table where you can store a copy of that record. Later, you can delete the temporary record instead of a file. I feel that much secure, and probably space-saving.
i think making this function from scratch will take long time , because i already got the function that writes to local hard dish up and running and the project time is to strict , this why i went for modifying the exist method from writing on HDD to write on server...
Think about this - how is your client supposed to locate this output?
Do they get a link to the excel file in an HTML page you return to them? If so then that link could point to a servlet that knows how to locate the file and write it to the output stream will the appropriate headers so that the client's browser will recognize it correctly.
Servlets to accomplish this are quite simple, I think that Bear has an example on his web site.