»
S
I
D
E
B
A
R
«
setting proxy in java
January 25th, 2010 by admin

setting proxy in java
What is proxy server settings and how to implement using Java coding detaily explain with code?

how to use proxy settings explain detaily

A firewall is a device that prevents traffic on certain ports (or any port) from happening. A port like the 80 that normally serves as HTTP, and another is 443, which is normally used for HTTPS. A proxy is a computer / server network administrators to give special privileges of access to port 80 and 443 (and maybe others) outside the firewall. You do not need to use the proxy, if the website you want to connect is within your server (your company) – Doing so probably will not work. To use a proxy in Java, you need to know two things. The proxy host name and the proxy port number. The port is where the proxy host to listen to new connections, not 80/443. If you are using HTTP and HTTPS, you need to know proxy server port for each (which may be the same). Your network administrators can say this information can not. Once you know the name and port number, do not really need any code changes. Just add parameters to run Java. The parameters are: http.proxyHost https.proxyPort https.proxyHost http.proxyPort For example, suppose I am inside a firewall and trying to connect to http://answers.yahoo.com: import java.net .*; import java.io. * Public class TryConnect (public static void main (String args []) throws Exception (URL u = new URL ( "http://answers.yahoo.com"); ();)) If compile u.openConnection TryConnect Java and run, I'll get an exception from the network – the firewall stops me. Suppose I know that my proxy is my.proxy.com and the port is 3100. If I run: java-Dhttp.proxyHost = = Dhttp.proxyPort my.proxy.com-3100 TryConnect'll be successful.

Web Service Proxy in Jdev 11g TP4


Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Blogplay

Leave a Reply

»  Substance: Play Roulette   »  Style: Ahren Ahimsa