Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Using Get/Post with HTTPS

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Desperado
Posts: 3226
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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");
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 427
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
http://jakarta.apache.org/commons/httpclient/
http://jakarta.apache.org/commons/httpclient/sslguide.html
 
What a show! What atmosphere! What fun! What a tiny ad!
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic