Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Getting a WWW-page

Posted on 1998-03-11
1
Medium Priority
?
154 Views
Last Modified: 2010-04-16
I'm working with a program that uses the following lines to get a www-page (form Visual J++ sourcebook). When I run
from within J++ it works, but with a browser the following
run-time error occurs "security. Couldn't connect to www.foo.foo with orgin from file". Whats up? I've also used
JDK, but I get the same result.

InputStream conx;
DataInputStream text;
String line;
StringBuffer b=new StringBuffer();

try{
                   conx=this.myUrl.openStream();
text=new DataInputStream(new BufferedInputStream(conx));
while ((line=text.readLine())!=null){
      b.append(line+"\n");
      }
}
catch(Exception e){
 showStatus ("Error reading file: "+ e.getMessage());
}
0
Comment
Question by:manne
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 6

Accepted Solution

by:
gadio earned 150 total points
ID: 1233497
It is not clear from your code to which URL you are trying to connect. The security model for applets and applications is different. An applet can not open any URL only a URL from the domain that it came from. Is your URL points to the machine that the applet comes from? If not make a test and try this kind of URL. I think that it will work. Bypassing this security model is possible but involves a lot of effort.



0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
The viewer will learn how to implement Singleton Design Pattern in Java.
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question