Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

applet/apps & proxy

Posted on 1998-08-14
5
201 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
diffSum example 4 50
how to see all occupied ports on windows 10 laptop 15 76
pagenation logic how it is working in my code 1 53
Running JavaFX on the Raspberry Pi 27 38
For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

840 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