Solved

FileDialog in applet

Posted on 1998-05-11
11
1,212 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
numbers ascending pyramid 101 241
hibernate example issues from command prompt 10 65
program arguments vs VM arguments 4 31
passing enum to a method 4 35
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
This video teaches viewers about errors in exception handling.

726 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