Solved

applet/apps & proxy

Posted on 1998-08-14
5
202 Views
Last Modified: 2010-04-16
how to access url when we are behind a proxy ?
0
Comment
Question by:mmouries
[X]
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
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
maven disable workspace resolution 1 41
collection output issue 9 65
Setup GlassFish 4 35
Java class and jar 3 42
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

733 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