I have a web application running under Apache Tomcat.
The user will have to provide a full path, choosing where to locate the file he wishes to download from the server. It is basically the opposite operation of upload.
I have encountered this issue while "Googling", trying to find an appropriate solution. The only solution which doesn’t fit was using a servlet and writing the file into the HttpServletResponse object!
I can’t use this kind of solution, since the user is been promoted with the File Download Dialog, which I am trying to avoid.
I have explored the HttpServletRequest object ,It seems I can extract the following data:
Is there any change I can use the IP Address to achieve the above?
I hope I was clear enough, Thanks for any help (solutions or Ideas!!!)
I don't think this is possible, and I certainly hope I'm right. I definitely do not want to access a website that starts writing data on my hard disk (other than cookies / cache data) without asking me first. No, you're really going to have to ask your users to save the file where they want to.
You may be able to use the remote IP address if and only if the machines are accessible by a preset means like Windows file sharing. Unless you're working within your own corporate or private network, where you can enforce this, you can forget about your requirements.
I am sure that you can download the files from server using the response object and by setting the response type as "application/pdf" in the resultant jsp header.
But you can never write files to your disk automatically as it is a web application.
Ajeeth Kumar wrote:I am sure that you can download the files from server using the response object and by setting the response type as "application/pdf" in the resultant jsp header.
I am also implementing the same behaviour in a web app and it works fine in windows
Except that that will not meet the (impossible) requirements of the original poster to write the file automatically to the file system of the client machine without user intervention.
Joined: May 08, 2011
I will give you guys some background…
I am implementing web applications for our company internal use (in internal network!)
In this scenario, the user is expecting the file to be copied to his local drive.
I understand that in the real web achieving this kind of functionality can be a real security hazard!
The clients are running under windows but the server is running under Linux!
Having the client IP address is not enough? Using some copy file protocol something like FTP?
The technical name for software that silently writes files to peoples computers is "virus". So you won't get any help from standard web protocols.
Furthermore, knowing the client's IP address does you no good, since HTTP is a strict request/response protocol. It cannot send anything down to the client that's unsolicited or to anywhere but the receiving socket on the client-to-server connection. Which will be closed immediately after the response has been received.
You will need client-side code to do what you're looking for. It can be an ActiveVirus, er ActiveX control or a signed applet or something like that, but basically it's got to be something that operates outside the normal sandbox security for J2EE.
A possible alternative for Windows users might be to supply the file through Windows provisioning services, which I believe are still called "SMS", if the Marketing Department hasn't decided to "improve" the name.
Another possible alternative would be to simply keep the file on a network share that the webserver has write access writes to so that the webserver can do out-of-band writes to the file. There are good arguments for this, as long as you don't truly need the file on the user's local machine (for example for disconnected laptop use).
Customer surveys are for companies who didn't pay proper attention to begin with.
Joined: May 08, 2011
Tim Holloway wrote:A possible alternative for Windows users might be to supply the file through Windows provisioning services, which I believe are still called "SMS", if the Marketing Department hasn't decided to "improve" the name.
Where can I find more information regarding Windows provisioning services?