• Post Reply Bookmark Topic Watch Topic
  • New Topic

Authentication Failure - Browser using JEditorPane

 
Vijayendra Vishwanath
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello to all Ranchers
this is my first post..

now coming to my problem--

I'm trying to make a simple browser for my application and of many options i choose JEditorPane to implement the browser.

When i try to execute the program i get the following error:

java.io.IOException: Authentication failure
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:649)
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:272)
at javax.swing.JEditorPane.getStream(JEditorPane.java:674)
at javax.swing.JEditorPane.setPage(JEditorPane.java:392)
at javax.swing.JEditorPane.setPage(JEditorPane.java:775)
at SwingExamples.EditorPaneFrame.jbInit(EditorPaneFrame.java:41)
at SwingExamples.EditorPaneFrame.<init>(EditorPaneFrame.java:17)
at SwingExamples.EditorPaneFrame.main(EditorPaneFrame.java:50)


I connect to internet through a Web Proxy which needs authentication.
After searching the net and through this forum i found that java.net.Authenticator can be used to provide authentication details.

This is the code i have written:



I get the same error even after i use the Authenticator. The JEditorPane establishes a HttpURLConnection by itself, so will it know about the proxy setting and also the authentication detials that i have set?

Any suggestions!!!
[ February 10, 2006: Message edited by: Vijayendra Vishwanath ]
 
Paul Clapham
Sheriff
Posts: 21892
36
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, the API documentation for the method says it will. But you could try it and see. Put some debugging statements inside the getPasswordAuthentication() method to see if it is being called.
 
Vijayendra Vishwanath
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for the advice Paul

i put some print statements in the getPasswordAuthentication() method as you have said. I found that this method is not being called.

but i have set the authenticator using



how can i get around this problem??

thanks in advance
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!