Solved

applet/apps & proxy

Posted on 1998-08-14
5
198 Views
Last Modified: 2010-04-16
how to access url when we are behind a proxy ?
0
Comment
Question by:mmouries
  • 3
  • 2
5 Comments
 
LVL 3

Expert Comment

by:sailwind
Comment Utility
Hmm.. I think accessing the outside should be transparent
to the program. Did you try to access the outside and was
unsuccessful?
0
 
LVL 2

Expert Comment

by:threshold
Comment Utility
I think the proxy should be decided by the browser...
I can't find any function in Java to setup the proxy server for URLConnection either.
0
 
LVL 3

Expert Comment

by:sailwind
Comment Utility
I was reading up on the book Migrating from Java 1.0 to Java 1.1
about the proxy. It made a mention of it, but did not specify an
example of how it can be done. I'll include bits and piece of information
and hope that you can benefit from it:

"Java 1.0 does support a way to enhance the acapabilities of the Socket-
based classes. You need to implement the java.net.SocketImpl class and
the java.net.SocketImplFactory interface. It gives you the ability to add functionality
for environment-specific situations in which you need to do something environmentally
specific for a network connection to take place. An excellent example of this would be
when you establish a connection to the Internet behind a firewall where all communication
needs to go through a proxy.

In Java 1.1, it has provided extendability of sockets. Extendable socket-based classes
are much more versatile and they are more focused on helping you add layers of
functionality, rather than just providing a way to compensate for the inconsistencies
between environments. It is still recommended that you use the subclassing -
SocketImpl apporach for any environmentally specific tasks.

P. 360/361.     If you are interested, you might want to check them out at your local
bookstore.
0
 
LVL 3

Accepted Solution

by:
sailwind earned 100 total points
Comment Utility
I found the same question asked by another user, the question's at:

http://www.experts-exchange.com/topics/comp/lang/java/Q.10072769

The answer is as follows:

--------

You can set both HTTP and SOCKS proxies:

    Properties sysprops = System.getProperties();

    sysprops.put("socksProxySet", "true");
    sysprops.put("socksProxyHost", "socks.whitehouse.gov");
    sysprops.put("socksProxyPort", "1080");

    sysprops.put("proxySet", "true");
    sysprops.put("proxyHost", "httpproxy.server.com");
    sysprops.put("proxyPort", "80");

--------

I believe you can simply replace the proxy host name with that of your
proxy. Port 80 is the default http port. This sets it up so that the
system know which proxy port to go out through. Hope it helped!
0
 
LVL 2

Expert Comment

by:threshold
Comment Utility
Does it need Syste.setProperties(...) after that?
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now