
Hi Guys, Thank you for the responses. I would just like to shed a little more light on the problem. I am currently able to get a reference to the file from my server, but even through this reference, the details in the file object are only usable within the server, e.g the path has the value like C:\docs\hello.pdf. This path is not usable within the client. I can create an input stream and output stream between the client and server using sockets and copy paste the file, but this is a very slow process. The server and client communicate via RMI, but to open a file, I am using: Process p = Runtime.getRuntime().exec("cmd /c start '+ path); the path provided by the server cannot be used by the client to open the right file. How else can this be done? Thank you, Duggan Kim On 4/16/09, wesley kiriinya <kiriinya2000@yahoo.com> wrote:
The devil is in the details for these sort of problem:
It is a complex problem because:
1. Files like pdf, doc, ... are files containing information that only the application that uses that file understands. Let's call it File Format. Unless the File Format is open (so that you know how to read the file data) then you will have to read the file through it's application. If the application (e.g. M$ Word) does not provide an API to stream a .doc file contents to the application then your other option is to open the network connection, stream the entire file and create a copy of it in the local system, then open that local file.
1.1. If for example you would like changes to the .doc file to be saved in the server, then you need to program the locking, unlocking stuff in the application that opens the file (in this case M$ Word) and the application needs to provide you with those mechanisms. If you did the local file way (as described above) then you have to take care of a problem where saving the file changes might result in a conflict. You can intergrate your network communication tool with a tool like SVN, so that SVN can pull the file for you and it will help you manage file conflict resolution.
2. If the file is not on a shared folder then you need a program running on the server to listen to client requests. With what you are planning to do, you might open a security hole through this server application.
o_O
--- On Wed, 4/15/09, Duggan Kim <mdkimani@gmail.com> wrote:
From: Duggan Kim <mdkimani@gmail.com> Subject: [Skunkworks] Java RMI / Network Programming To: skunkworks@lists.my.co.ke Date: Wednesday, April 15, 2009, 5:49 PM
I am writing a java based peer to peer application that requires remote files (pdf, text, .doc etc) in the server to be opened(run) in the client, the same way you would open a shared file in a different machine from your machine. How do I create a URL to the remote file considering that the file is not necessary contained in a shared folder, or how do you open the file via a remote File object reference?
Any ideas would be appreciated.
Thank you,
Duggan Kimani. _______________________________________________ Skunkworks mailing list Skunkworks@lists.my.co.ke http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks Other services @ http://my.co.ke