Solved

applet/apps & proxy

Posted on 1998-08-14
5
200 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
ID: 1232785
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
ID: 1232786
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
ID: 1232787
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
ID: 1232788
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
ID: 1232789
Does it need Syste.setProperties(...) after that?
0

Featured Post

ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
groupNoAdj 7 95
Error trying to install RTMT Win7 5 60
how to add new optional parameter to JSP 1 41
ejb on wildfly 5 20
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
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…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
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:

777 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