If I read your post right - then you would need to create a policy file for
the applet giving it access to the specified URL.
The tool to create this is the 'policytool.exe' in the JDK's \bin path.
Hope that helps
sc
-----Original Message-----
From: Venkata Kanugula
[mailto:[EMAIL PROTECTED]]
Sent: Monday, August 16, 1999 2:33 PM
To: [EMAIL PROTECTED]
Subject: Applet-Servlet communication
Hi,
I have an untrusted applet which invokes a Servlet. The
Problem is not with the Servlet. The Servlet works fine when
it is invoked directly. I am not able to open http: \\
connection thru my applet. It gives my Security problem.
After invistigtating the matter it came to my notice that
untrusted applets can neither access files nor open http:\\.
The applet code is as follows.
Void actionPerformed(ActionEvent event) {
InetAddress localHost = null;
String localhostAddress = null;
try {
localHost = InetAddress.getLocalHost( );
<------------------ Problem: 1 (Gives me "local host not found")
localHostAddress=localHost.getHostAddress(
); (If I comment it out..., pls see the next problem)
} catch (UnknownHostException e)
{ System.out.println("local host not
found");
}
URL url = null;
URLConnection con = null;
try {
url = new
URL("http://"+localHostAddress+":8080/servlet/My2Servlet");
<----------------- Problem 2
(If I directly replace
localHostAddress as
localhost, I get socket failure 127.0.0.1)
con=url.openConnection( );
con.setDoInput(true);
con.setDoOutput(true);
===================
===================
===================
===================
Some useful Info:
-------------------------
Win95/JDK1.2/JSDK2.1/Netscape 4.x.
Message in Java Console
-----------------------
Code Base files cannot access http:/..
Servlet runs fine at
http://localHost:8080/servlet/My2Servlet.
If the applet needs to be trusted, can anybody tell me how
to do that?
Thank you.
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and
include in the body
of the message "signoff SERVLET-INTEREST".
Archives:
http://archives.java.sun.com/archives/servlet-interest.html
Resources:
http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html