java.net.URL.openStream () - problems with authentication -
11-16-2004
, 11:27 AM
Hello all,
Do you know why behaviour of URL.openStream () differs in Java Applets and
J# Browser Controls and how to achieve Java Applet behaviour for URL class
in JBC?
Here is simplified version of my applet. It should read first line of file
doc.xml that is in the same directory as applet itself. It works always
correctly when compiled and run as java applet (both Microsoft JVM and Sun
JVM). But it cannot access the file when compiled and run as J# Browser
Control and IIS authentication method is basic authentication or integrated
windows authentication. Server returns "HTTP 401.2 - Unauthorized: Logon
failed due to server configuration" error message.
public class App extends Applet {
public void init () {
URL url = new URL (this.getCodeBase(), "doc.xml");
String s = new BufferedReader (new InputStreamReader
(url.openStream ())).readLine ();
// ... ...
}
}
Does anyone can suggest how JBC can access server resources?
Thank you,
Alexey |