Solved

About Proxy Server

Posted on 1998-07-02
1
150 Views
Last Modified: 2010-03-30
If i want to download any page for a given URL i'll have to
download the page from the Proxy Server. How can i connect my program with the proxy server to download the required page through my program?
0
Comment
Question by:pappu070298
1 Comment
 
LVL 5

Accepted Solution

by:
fontaine earned 100 total points
ID: 1224429
You have two options.

1) At the starting of the program, use a command line similar to the following:

java -DproxySet=true -DproxyHost=proxy.com -DproxyPort=80 MyJavaProg

2) In your Java prog. add the following:

import java.util.properties;
// bla bla bla

Properties props = System.getProperties(); // get the system properties
props .put("proxySet", true); // inform the VM to use a proxy
props .put("proxyHost", "proxy.com"); // specify the proxy server to use
props .put("proxyPort", "80"); // specify the port the proxy server is listening on
System.setProperties(props); // set the (modified) system properties

The rest does not change in your program. Example: if you want to get the home page of
EE, you will use the "http://www.experts-exchange.com" URL in the app. Because you
have configured the app. the use of a proxy,  the EE homepage will automatically
be loaded through the proxy.
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Java Timer (static) 9 43
diffSum example 4 36
reverse digits of a number using for loop 5 40
Desingning Refactoring existing code 2 24
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…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
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 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:

776 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