aspose file tools*
The moose likes Applets and the fly likes remote JFileChooser or similar? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "remote JFileChooser or similar?" Watch "remote JFileChooser or similar?" New topic
Author

remote JFileChooser or similar?

Andrew Reinartz
Greenhorn

Joined: Jul 02, 2003
Posts: 3
I have my server-client working the way I want it to so far (just using normal socket-stream communication, not RMI or anything), but I have a question. I'll need to browse some files on the server-side to select one to run some server-side manipulation on. How can I go about this? Is there any way to use JFileChooser remotely (my client-side is Swing based)? Or can I send file arrays from the server to the client that list the current directory say? Any help would greatly appreciated. Thanks,
~Andrew
Maulin Vasavada
Ranch Hand

Joined: Nov 04, 2001
Posts: 1871
hi andrewe,

can I send file arrays from the server to the client that list the current directory say?

yes. u can. u can create an Object sort of like,
class FileEntry {
String name;
Vector sublist;
boolean isFile; // file or directory flag
}
name is the name of the FileEntry and the sublist is nothing but the list of sub FileEntry objects.
so its kinda "recursive" object reference u know...
now, u can prepare FileEntry for the directory and it will recursively contain the entries for the all the subdirectories and files and so on...
prepare this object on the server side via some servlet or something and then make the applet-servlet communication via ObjectOutputStream to write this FileEntry object to the applet.
once u get the this big object on applet side u can traverse through it and display it in tree format if you want...
hope this helps..
regards
maulin
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16061
    
  21

oft-repeated Caveat: a WEB server is NOT a FILE server!
IFF your web server box ALSO has file-serving software on it (Samba, Windows Networking, NFS, etc.) THEN you can browse network shares courtesy of the FILE server software, but not otherwise.
Or, if you can see the server files in Windows Notepad file browser (for example), then you can see the files using the Swing file browser. But your web client and server (or lack thereof) have nothing to do with the process.
You can program part of a webapp to act like it's a miniature file server by writing suitable server-side code. The apparent file serving abilities that many web servers seem to have (sometimes by default) is illusory. They aren't giving you access to the file - in fact, HTTP has no such abilities. They're making a copy of the file and sending it to you.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: remote JFileChooser or similar?