Look at the following article. It may not be the exact solution but it may give you 
some pointers:

http://www.javaworld.com/javaworld/jw-10-1998/jw-10-apptowin32.html

--
sabir semerkant | [EMAIL PROTECTED] | founder & CTO | rare minds






-----Original Message-----
From:    Venkata Kanugula
Sent:    Mon, 16 Aug 1999 12:33:24 -0700
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




_______________________________________________________
Get Visto!  Groups, event calendars, email, and more...
Check it out @ http://www.visto.com/info

___________________________________________________________________________
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

Reply via email to