aspose file tools*
The moose likes Applets and the fly likes Writing to a server from an applet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "Writing to a server from an applet" Watch "Writing to a server from an applet" New topic
Author

Writing to a server from an applet

Eoin Mac Aoidh
Ranch Hand

Joined: May 19, 2005
Posts: 48
I am trying to create a html page based on data I obtain from an applet, and store this page on the server, where the applet is running from. It works when I test it locally on my own machine, but when I try it live, online, it dosnt seem to create the page.

The (edited) code I use to create the page is as follows:


The execution of the code dosnt seem to go into the try. It just stops there.
I set all the permissions on the folders required to #777
Perhaps its not possible to use a buffered writer in this manner?
Ive been trying a few things with URI references instead of file objects but Im not having much luck there.

Any help greatly appreciated.
Thank you,

Eoin.
[ July 04, 2007: Message edited by: Eoin Mac Aoidh ]
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39548
    
  27
catch(IOException ioexception) { }

Empty catch blocks are rarely a good idea, and definitely not with an IOException. How will you know what's going wrong?

Since the applet is attempting file I/O, it needs to be signed, or the local security policy altered. Is that the case? (Details about both are at HowCanAnAppletReadFilesOnTheLocalFileSystem).


Ping & DNS - updated with new look and Ping home screen widget
Eoin Mac Aoidh
Ranch Hand

Joined: May 19, 2005
Posts: 48
Thanks Ulf,
I dont think its a security problem, the applet is signed. It seems to be something else.
Thamks for the I/O exception tip. - Ill work on that. I just threw the try/catch clause together quickly for the sake of creating a coherent post.

Eoin
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39548
    
  27
I just noticed you're trying to construct the file name from "AppletCodebase" - if that's what the getCodeBase method returns, it can't possibly work, because if run on a web server it would be an HTTP URL (and there'd definitely be an IOException thrown).

Oh, and any file the applet writes would of course be created on the client, not on the server.
[ July 04, 2007: Message edited by: Ulf Dittmer ]
Eoin Mac Aoidh
Ranch Hand

Joined: May 19, 2005
Posts: 48
Thanks again Ulf.
I was trying to use the getCodeBase method, running on a webserver and I was also trying to create the file on the server, not the client but I guess thats just not possible...
Ive worked around it though and created a file on the client. Its not quite what I wanted, but it will do! thanks for your pointers.

Eoin.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Writing to a server from an applet
 
Similar Threads
Calling Javascript functions from an applet
ojdbc connection through Applet from a Browser.
Dynamically assign an included bean property
Controling the browser
getParameter() limit