Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

applet/apps & proxy

Posted on 1998-08-14
5
Medium Priority
?
208 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 200 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

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

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…
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 how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
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:
Suggested Courses

604 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