I am playing with Tony Alicea's Application to get the HTTP header. It is a well written application. Good job...Tony I have the following requirements. We have been using a proxy server. So I should be able to specify the IP address of the proxy server. I need to Get/Post some data from/to a web site which is using HTTPS protocol. I read somewhere We have to use URLConnection class rather than HttpURLConnection for doing this. Has anybody done this? i.e. writing a Client java application to Get/Post data to HTTPS server? I really apprecaite, if anyone can through some light on this.
Joined: Jan 30, 2000
Well, thanks... my employer also likes that app... And since I am now (well, was, since they made an exception and now allow my workstation to BYPASS the proxy...) From the Java FAQ at www.afu.com (Peter van der Linden's):
10.(Sect. 15) How do I get a URLConnection to work through proxy firewalls? I.e. How do you get your application to do its web accesses through a proxy? This is typically needed for any net access to another domain. Tell the run time system what you are trying to do, by using these commandline arguments when you start the program. java -DproxySet=true -DproxyHost=SOMEHOST -DproxyPort=SOMENUM classname Note proxyPort is optional and it defaults to 80. Without this, you will see an exception like java.net.UnknownHostException or java.net.NoRouteToHostException The proxy settings work for java.net.URLConnection, but apparently not for java.net.Sockets. Update! The proxyHost and proxyPort systems properties (from 1.0.2) are deprecated, you should use http.proxyHost and http.proxyPort. They are for HTTP proxies only. If you are using java.net.Socket you are not using the URL classes, and cannot get the proxy behavior. Netscape's and IE's JVMs (at least in versions 4.x+) take the proxy settings for applets from the browser's proxy configuration. You can also do URL proxies in applications (not applets) with the following code:
// set up to use proxy System.getProperties().put("proxySet", "true"); System.getProperties().put("proxyHost", "myproxy.server.name"); System.getProperties().put("proxyPort", "80");
Tony Alicea Senior Java Web Application Developer, SCPJ2, SCWCD
Joined: Jun 20, 2002
Well, I'm trying to piggy back off this posting. One question, how do you get the proxy settings from the browser's proxy configuration? I know that NS stores them in a flat file but IE stores these setting in the registry and Java doesn't have the capability to read the registry with out using JNI. Thanks