Solved

FileDialog in applet

Posted on 1998-05-11
11
1,205 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
Comment Utility
Yes if you build one, No otherwise. At least not that I know of
0
 

Author Comment

by:felgen
Comment Utility
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
Comment Utility
 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
 

Author Comment

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

Expert Comment

by:gadio
Comment Utility
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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 

Author Comment

by:felgen
Comment Utility
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
Comment Utility
 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

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)
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

772 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now