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
Solved

Getting a WWW-page

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone 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
Apps blocked by Java 9 88
couple of eclipse 5 46
jsp login check 12 42
Java Restore security prompts not working 10 63
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…

837 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