Solved

FileDialog in applet

Posted on 1998-05-11
11
1,208 Views
Last Modified: 2013-11-23
Is it possible to have a Dialog
like FileDialog that reads from the Directory
of the HTTP-Host the applet is coming from?
0
Comment
Question by:felgen
  • 4
  • 3
  • 3
  • +1
11 Comments
 

Expert Comment

by:prg022698
ID: 1220920
Yes if you build one, No otherwise. At least not that I know of
0
 

Author Comment

by:felgen
ID: 1220921
I've tried to use the FileDialog class.
Running from within Development-Tool it certainly worked
because in that case the "file" protokoll was used.
Running within a browser I got a java.lang.NullPointerException
(shouldn't it be a SecurityException).
I've set the working directory of the filedialog to the directory
the applet was comming from. My idea was, that this directory
can be read from the applet.
What is the difference between the FileDialog class and
a class build by myself?

0
 
LVL 6

Expert Comment

by:gadio
ID: 1220922
 felgen, in order that the applet will be able to read (opening a file dialog is local disk read) it must be signed. I don't think that there is a difference in the IO operation that you might do opening a FileDialog and building a filedialog yourself. There are fue options for you to use:
1. Sign the applet with a test certification autority.
2. Buy a certification autority and sign the applet with it.
3. Enable the brawser to work with the applet as if its signed.
All of these options are different for Netscape and for IE. Note that for the distribution of your applet only option 2 is relevant. If you want some more info about some of these options for a given browser, I'll add a comment about it here.

G.
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

Author Comment

by:felgen
ID: 1220923
Signed Applet requires jdk1.1.x, right?
I want to do it with jdk1.0.x.
0
 
LVL 6

Expert Comment

by:gadio
ID: 1220924
felgen, I think that you will have to compromise here. You can't open the security model for applets without signing the applet or opening the brawser to look at an applet/site as trusted (only in the latest versions of the brawsers).
0
 

Author Comment

by:felgen
ID: 1220925
I've a additional question. A signed Applet can read and write
from the client filesystem, e.g. with the class FileDialog, but
how can I get access to the filesystem of the host the applet came from and is this access for unsigned Applets restricted
through the Security Model.
0
 
LVL 6

Expert Comment

by:gadio
ID: 1220926
 If you want the applet to access the host file system you can do:
1. Open a file on the host as a url (that is good only if the file is in the part of the filesystems that is mapped by the http server).
2. Use CGI-BIN.
3. Use servlet.
All of these options are not restricted by the security model (if you are addressing the host). The first one is only client side code, and the other two are server and client side code.

0
 

Author Comment

by:felgen
ID: 1220927
My intension was not to read from a file in the filesystem of the HTTP-Server.
I only wanted to use the FileDialog class to browse through the filesystem and get
back path informations of a file. It would be nice if there is a possibility to change
the behavior of the class FileDialog or to use the corresponding peer.
0
 
LVL 4

Expert Comment

by:evijay
ID: 1220928
In future, the swing JFileChooser (FileDialog in swing) in com.sun.java.swing.preview package will be extended to handle URL's and this will solve your problem. Until then, try to rework swing source code and find a way to handle your problem.
You definetely need a proxy (a servlet or a file server) on the host you are working on. Its quiet a complex problem to solve.

best thing is developing yourself a poor man's file dialog which serves your purpose.

0
 
LVL 4

Accepted Solution

by:
evijay earned 100 total points
ID: 1220929
The answer is no such facility builtin the filedialog. You need to implement your own file dialog and a proxy server which serves the file details on the host.
see swing source for implementing a filedialog and java telnet applet for implementing a proxy server.

combine the too and implement the file dialog;
0
 
LVL 4

Expert Comment

by:evijay
ID: 1220930
0

Featured Post

ScreenConnect 6.0 Free Trial

At ScreenConnect, partner feedback doesn't fall on deaf ears. We collected partner suggestions off of their virtual wish list and transformed them into one game-changing release: ScreenConnect 6.0. Explore all of the extras and enhancements for yourself!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Java DateChooser? 3 36
custom annotations 9 39
replace a word with other 1 44
JavaFX TableView not displaying correctly 3 18
For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question