problem with URLConnection behind a firewall

V

vj

Hi,

I am creating a URLConnection object behind a firewall and facing some
serious problems.
The thing goes on smooth untill firewall does not enforces security. As
soon as user authorization is enforced the thing stops working. The
firewall is HTTP working on port 8080 of localhost. Here is the code
that i am using

/*************************CODE************************/
Properties systemSettings = System.getProperties();
System.setProperties(systemSettings);

URL url=new URL("http://someserver/somepage");
URLConnection uc = url.openConnection ();
String encoded = new String
(Base64.base64Encode(new
String("username:password").getBytes()));
uc.setRequestProperty("Proxy-Authorization", "Basic " + encoded);

System.out.println("Connecting...");
uc.connect();
InputStream is= uc.getInputStream();
System.out.println("Connected and retriving data...");

/***********************************************************/
the main problem is that as soon as authorization is enforced the
programs freezes after giving the output "Connecting..." !!!

Any ideas what really is the problem. I have tried googling and tried
all sorts of methods that were suggested on the web.


Thanks,
VJ
 
G

Graham

Hi vj,

Are you using a firewall
(http://en.wikipedia.org/wiki/Firewall_(networking)) or a proxy
(http://en.wikipedia.org/wiki/Proxy_server)? There are some
differences, so it is worth checking what you are actually working
with.

If you are actually using a proxy then you need to look at:
http://java.sun.com/j2se/1.5.0/docs/api/java/net/Proxy.html

You can pass the proxy object when you call url.openConnection ()

Regards,

Graham
Lead Senior Developer
Modern Security Solutions
http://www.modernsecuritysolutions.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top