Solved

Getting a WWW-page

Posted on 1998-03-11
1
149 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 50 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
hibernate jars 4 59
hibernate example using maven 12 82
mysql jsp example issue 32 74
jmeter usage 4 37
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This video teaches viewers about errors in exception handling.

733 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