Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / November 2007

Tip: Looking for answers? Try searching our database.

Java applet file handling on Web

Thread view: 
WebNovice - 22 Nov 2007 15:40 GMT
I want to create/read/write files using a Java applet on a website.
I've written a trivial applet in Netbeans & it runs OK when tested in
NetBeans. When moved to a different folder on my PC with a .html file
to call it, it gives error "Java.security.AccessControlException:
access denied (java.util.PropertyPermission user.dir read)". The same
problem occurs on a website. I must need to set permissions. But
Where? and How? Thanks
Andrew Thompson - 22 Nov 2007 16:07 GMT
>I want to create/read/write files using a Java applet

If using a rich client, why not launch the GUI using web start?
e.g. <http://www.physci.org/jws/#jtest>  
If using web start, it might be better to just make it an
application (based on a JFrame).

>..on a website.

Uh-huh.
Reading the (publicly accessible) files from the same
web site is no problem.
Creating and writing files on a web site is a whole
different matter.  Mostly there are security considerations,
and the *web site* itself must support the file upload
functionality.  The upload code on the server might
be written as JSP, Servlet, (PHP, ASP..), but the client
itself cannot take responsibility for writing the files,
the server *must* do that itself.

That is why..

>I've written a trivial applet in Netbeans & it runs OK when tested in
>NetBeans. When moved to a different folder on my PC with a .html file
>to call it, it gives error "Java.security.AccessControlException:

A 'client' such as an applet (or JWS appl.) cannot get
a 'File' on the 'server' - ever.

To access files on the client is a different matter
again.  An applet would need to be signed and accepted
by the user with full permissions - even then, there was
suggestion some of the latest IE browser variants
will limit the directories that an applet can read
from/write to.

A JWS app. would *not* need to be signed to access
files off the local file-system. Instead it could use the
extra services available in the JWS (javax.jnlp.*) API,
such as the FileOpenService.
<http://www.physci.org/jws/#fs>
(<http://www.physci.org/jws/filetest-sandbox.jnlp>)

What sort/flavor(/size..) of files are you needing to support?

What does this 'file upload' facility aim to provide to
the end user?  (the wider picture, like 'allow them to
create web based sites generated from genealogy
files' or 'enable the user to create image slideshow
sites'.)

Signature

Andrew Thompson
http://www.physci.org/

WebNovice - 22 Nov 2007 23:12 GMT
To Andrew Thompson

Thanks for the detailed reply and web references. On my PC I have a
folder which is an image of the Web site & I hoped to be able to run
the "web site" locally using "open with internet explorer" for testing
and to give clues to problems on the actual site. The necessary
permissions etc sound formidable to implement - I may have to proceed
slowly.

The aim is to use the web site as a post office to run a old play-by-
mail computerised wargame. Turns are processd  periodically (eg
weekly) at HQ (my PC). Results are sent to players via .txt files.
Players also must download a Java program as java .class files. This
they run on their PCs to view the latest stae of play & to enter
orders which are periodically sent back to HQ also as .txt files for
validation & processing. There is an e-mail version in which the data
transfer is by zipped e-mail attachments but the interest in this is
underwhelming probably because people are reluctant to reveal e-mail
addresses.

aptly

WebNovice


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.