Loading non-media files from applets

Q

Qu0ll

Is it true that an applet cannot read a file stored in the same directory on
the server as the applet JAR unless it's an image or sound file? I believe
this is so but I would like to confirm it.

--
And loving it,

-Qu0ll (Rare, not extinct)
_________________________________________________
(e-mail address removed)
[Replace the "SixFour" with numbers to email me]
 
A

Arne Vajhøj

Qu0ll said:
Is it true that an applet cannot read a file stored in the same
directory on the server as the applet JAR unless it's an image or sound
file? I believe this is so but I would like to confirm it.

No.

It can send HTTP requests to the server it came from.

Those requests can fetch anything.

Arne
 
A

Andrew Thompson

No.

It can send HTTP requests to the server it came from.

(further..)
an applet can obtain a resource from any
directory of the server that it originated
from, of any type, so long as the server
is willing to serve that resource.

So more pointedly, an applet in /lib *
of a site, could read the bytes of
either a DLL or a .WHATEVER from the
root of the server, its parent directory
(I mention that because it seems a common
misconception that applets cannot read from
a directory 'above' the applet).

* With applet page and codebase in /lib as well.

On the flip side, I have noticed some odd
resource fetch errors (security) when applets
running from the *local file system* attempt
to reach outside their own directory.

(Maybe it is best to test applets using a
local server.)
 
A

Arne Vajhøj

Andrew said:
(further..)
an applet can obtain a resource from any
directory of the server that it originated
from, of any type, so long as the server
is willing to serve that resource.

Yep.

Somewhere below it will also end up as a HTTP request though.

Arne
 
Q

Qu0ll

Arne Vajhøj said:
Yep.

Somewhere below it will also end up as a HTTP request though.

I was thinking more along the lines of when an applet is served up without
using a web or application server i.e. when simply opening an HTML file on
the local file system with an applet (and some interesting other files) in
the same directory. It seems that in this case, building a URL using
getCodeBase() and the resource name results in a "file:/"-type URL pointing
to the appropriate resource but it can't use access it because it can't
directly access the local files system. Does that make sense?

--
And loving it,

-Qu0ll (Rare, not extinct)
_________________________________________________
(e-mail address removed)
[Replace the "SixFour" with numbers to email me]
 
A

Arne Vajhøj

Qu0ll said:
I was thinking more along the lines of when an applet is served up
without using a web or application server i.e. when simply opening an
HTML file on the local file system with an applet (and some interesting
other files) in the same directory. It seems that in this case,
building a URL using getCodeBase() and the resource name results in a
"file:/"-type URL pointing to the appropriate resource but it can't use
access it because it can't directly access the local files system. Does
that make sense?

If it is running on the local system, then make it an app instead of
an applet.

Arne
 
K

Knute Johnson

Qu0ll said:
Is it true that an applet cannot read a file stored in the same
directory on the server as the applet JAR unless it's an image or sound
file? I believe this is so but I would like to confirm it.

Others have answered your question but I just wanted to mention that an
Applet may make any sort of connection to the server address that it was
served from. You can for example run another server on the same machine
as the web server and the applet may connect to that server as well.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top