Solved

Getting a WWW-page

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
array6 challenfge 6 65
return in catch statement 1 40
mapBully challenge 6 92
Java and GPO 11 47
For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

746 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now