Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to access to a web server from my java program rather than using

Status
Not open for further replies.

igowi

Programmer
Sep 18, 2001
45
US
I am trying to access to a web server which requires authentication. (HTML has javaScript and Applet)
I send "Form" to the web server.
I got this message."Sorry, administration of (company name) requires a browser
which supports frames." I guess they might close the session issuing this HTML file which includes the message.
How can I access to the web server from my java application?
How can I keep the permission to the server?
I really need your help.
thanks.
 
Hi,

If that "Sorry, ..." was what you received from response when you sent (using HTTP POST, I suppose) that form to the server, I don't belive that it was because of the need of authentication.
Instead of, I think that this message was because the HTML page you tried to receice used frames and the message you saw was between <NOFRAMES>...</NOFRAMES> -tags...

But if you need authentication you can use sun.misc.Base64Encoder
Here is an example how to use it (from URL:
URL url = new URL(&quot;URLConnection connection = url.openConnection();
String login = &quot;username:password&quot;;
String encodedLogin = new BASE64Encoder().encodeBuffer(login.getBytes());
connection.setRequestProperty(&quot;Proxy-Authorization&quot;, &quot;Basic &quot; + encodedLogin);

...and so on....

-Vepo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top