🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #15653

Re: Security violation from applet

#15653
From: Oliver Horlacher
Date: Thu, 20 May 1999 00:00
76 lines
2857 bytes
I hope that I am not putting you wron here but as I understand it you
are atempting to accesa html page other than the one on which the applet
came from (not your own computer).  If that is so then the applet
security will not allow this.  n applet is only allowed to open a socket
to the server that it origenated from.  In other words the applet can
only phone home.  The way to get around this is to write a proxy server. 

Hope that helps

Olli

Nathan Katzenstein wrote:
> 
> First Java Applet for me!! Trying to read a remote HTML page.
> 
> When i run the following applet in an HTML file, i get the following
> error:
> 
> Applet Monitor security violation: security.class from local disk trying
> to access url: http://ibm.com
> 
> What am I missing?????
> 
> Nathan
> 
> import java.awt.*;
> import java.net.*;
> import java.io.*;
> import java.applet.Applet;
> 
> public class Monitor extends Applet
> {
>     public void start()
>     {
>         try
>         {
>             // Check to see that a command parameter was entered
>             //if (args.length != 1)
>             {
>                  // Print message, pause, then exit
>                  //System.err.println ("Invalid command parameters");
>                  //System.in.read();
>                  //System.exit(0);
>             }
> 
>             // Create an URL instance
>             URL url = new URL("http:////www.ibm.com");
> 
>             // Get an input stream for reading
>             InputStream in = url.openStream();
> 
>             // Create a buffered input stream for efficency
>             BufferedInputStream bufIn = new BufferedInputStream(in);
> 
>             // Repeat until end of file
>             for (;;)
>             {
>                 int data = bufIn.read();
> 
>                 // Check for EOF
>                 if (data == -1)
>                     break;
>                 else
>                     System.out.print ( (char) data);
>             }
>         }
>         catch (MalformedURLException mue)
>         {
>             System.err.println ("Invalid URL");
>         }
>         catch (IOException ioe)
>         {
>             System.err.println ("I/O Error - " + ioe);
>         }
>     }
> }
Technical Details
Message-ID: <3743A39D.1A92@xtra.co.nz>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <3742F83E.413E754B@prenhall.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,30cb1802a2a37a58
X-Google-Attributes: gidf74b3,public
From: Oliver Horlacher <horlacher@xtra.co.nz>
Subject: Re: Security violation from applet
Date: 1999/05/20
Message-ID: <3743A39D.1A92@xtra.co.nz>
X-Deja-AN: 479920000
Content-Transfer-Encoding: 7bit
References: <3742F83E.413E754B@prenhall.com>
Content-Type: text/plain; charset=us-ascii
Organization: Olli's Think Tank
Mime-Version: 1.0
Reply-To: horlacher@xtra.co.nz
Newsgroups: borland.public.jbuilder.java.language