HttpUrlConnection's and Proxies

I'm trying to sort out an app where I have to go thru a web proxy with user authenication in order to access a web.

Can anyone provide some ideas as to how to do this? HttpUrlConnection allows u to specify if u're going thru a proxy, but seemingly vague on how to enter/specify user id/password?

[318 byte] By [fuzzybr] at [2007-9-26 4:20:31]
# 1

Ok no one replied - let me povide details:

Well I'm (or my client) is connected to a LAN that has to go thru a proxy to access the web.

Assuming the proxy is http://proxy.foo.bar:8000

and his username and password authenication required is

username:foo

password: bar

how do I use httpurlconnection (or other means) to access the web by providing this info. Futhermore, is there a way to tweak it so that the user enters his username and password when its required?

I really appreciate an answer. Deadline running closer =)

fuzzybr at 2007-6-29 17:23:51 > top of Java-index,Archived Forums,Java Programming...
# 2

hi,

usually basic http authentication works like this:

http://foo:bar@proxy.foo.bar:8080/

however, I don't think that the proxy uses this type of authentication and therefore you will need to use sockets. The latter is not my favorite section of Java and so I cannot give further hints. Hope this helped though.

best regards, Michael

Michael_Rudolf at 2007-6-29 17:23:51 > top of Java-index,Archived Forums,Java Programming...
# 3
I was asking if I wanted to access say http://www.google.com/ thru this particular proxy then how would I do so in Java (using HttpUrlConnections or otherwise). Some code be good.
fuzzybr at 2007-6-29 17:23:51 > top of Java-index,Archived Forums,Java Programming...
# 4
See http://www.javaworld.com/javaworld/javatips/jw-javatip42.html and http://www.javaworld.com/javaworld/javatips/jw-javatip46.html
neville_sequeira at 2007-6-29 17:23:51 > top of Java-index,Archived Forums,Java Programming...