• Post Reply Bookmark Topic Watch Topic
  • New Topic

HTTPS Request with Proxy server.

 
sarath chadrach
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,


In my development server, I used to connect to one public network site by directly using HTTPURLConnection and it is working perfectly fine.

The problem exists in the other server where there is a need of proxy server to connect to the public network. I'm using the proxy setting with the port as 8080 to connect a site with the HTTPS request then I'm getting the error as Internal server error.

Please let me know whether I can connect to a site with HTTPS request in the proxy server port 8080.
 
Wouter Oet
Bartender
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is also a HttpsURLConnection class. Check that out.
 
Rob Spoor
Sheriff
Posts: 20822
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you using the URL.openConnection(java.net.Proxy) method?
 
sarath chadrach
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The following it the code I'm using for the same.

The url is like this https://test.com

 
Rob Spoor
Sheriff
Posts: 20822
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please UseCodeTags next time. I've added them for you this time. I've also decreased the indentation level.

If you need to go through a proxy server you should use openConnection with a java.net.Proxy instance. (I already asked if you used that before; apparently you don't.)
 
sarath chadrach
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rob Spoor,

Thanks for the prompt reply.


I'm not sure whether we have proxy instance usage in Java 1.4. Please suggest me on the same.

Because of the above I'm sending the proxy to the URL constructor.
 
Rob Spoor
Sheriff
Posts: 20822
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
java.net.Proxy was added in Java 5.0. Perhaps you can use the suggestions on http://www.java.com/en/download/help/proxy_setup.xml

But why are you still using Java 1.4? It's been replaced by two major Java versions already, with the third (Java 7) on its way.
 
sarath chadrach
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rob Spoor,


Yes you are right but we don't have any option other than using the java 1.4 only.


The http://www.java.com/en/download/help/proxy_setup.xml will not help because I'm doing this in an Servlet. Please suggest me on the same.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!