[3280] in java-interest

home help back first fref pref prev next nref lref last post

Re: More Java questions!

daemon@ATHENA.MIT.EDU (Jim Graham)
Sun Nov 5 23:37:25 1995

Date: Sun, 5 Nov 1995 19:03:59 -0800
From: flar@bendenweyr.Eng.Sun.COM (Jim Graham)
To: java-interest@java.Eng.Sun.COM, gary@post.acadia.net


Hi Gary,

> Say, on my Web page, there's a rectangular area that's going to be filled
> with... something.
> 
> The user accesses my page.  A Java applet is downloaded and executed.  It
> does some computations, and comes up with an ASCII string which represents
> a URL.

Why were those calculations performed on the user's machine?  Java
security should restrict it from getting access to any information in
the user's local environment which might be used as input in performing
its calculations so there should be no benefit in performing those
calculations on the client versus in the server.

One possibility that I can think of is that you might want to get input
from the user first and then generate a URL on the fly based on their
responses.  In that case, there may be some missing pieces that prevent
you from embedding the URL directly (see below).

> I want the object at that URL to automatically be displayed in the
> aforementioned rectangular area.

Why not calculate which URL should go there and embed the appropriate
object on your server before sending the page down?

> Question 1) Is the above scenario possible with Java?

The Applet API will allow an Applet to instruct the browser to jump to
a different URL using getAppletContext().showDocument(), but we don't have
sophisticated enough APIs yet to allow you to embed some of the kinds
of documents you can access through URLs.  If the URL referred to an
image then you could do a getImage(URL) on it and then display that image
in your rectangular area using drawImage().  But if the URL refers to,
for instance, an HTML document then you would have to write your own
HTML formatter (for now) since we don't have any interfaces for embedding
new HTML on the fly from an Applet.

> Question 2) Can this URL be at a different Web site with a different domain
> name?

It depends on the Java Security policies specified by the user's browser.
Netscape currently only supports a security policy in which Applets are
only allowed to connect back to the specific host that they were loaded
from.  The HotJava Alpha browser allowed the user to choose between that
policy and a less restrictive one based on defining firewalls (as well
as an unrestricted policy to be used for testing only).  In short, you
should expect that your applet may frequently be unable to access any
host other than the one it is loaded from.  A workaround would be to
provide a proxy service on your web site where the applet would go back
to its host and ask that host to get the necessary information from some
other host and forward it on to the applet...

				...jim
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post