Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Jakarta-httpclient 
Wiki" for change notification.

The following page has been changed by JoshuaPreston:
http://wiki.apache.org/jakarta-httpclient/FrequentlyAskedApplicationDesignQuestions

------------------------------------------------------------------------------
  for all clients is itself a complex task.
  
  
+ -------
+ == Client Through a Proxy ==
+ 
+ At this time, the system properties '''http.proxyHost''' and
+ '''http.proxyPort''', etc., have no affect on the proxy usage.  Until
+ this functionality is added, you must specify the proxy information
+ at runtime, similarly to the following example:
+ 
+ {{{
+ 
+  String proxyHost = System.getProperty("http.proxyHost");
+  int proxyPort = Integer.parseInt(System.getProperty("http.proxyPort"));
+ 
+  String url = "http://www.google.com";;
+ 
+  HttpClient client = new HttpClient(new MultiThreadedHttpConnectionManager());
+  client.getHttpConnectionManager().getParams().setConnectionTimeout(30000);
+         
+  client.getHostConfiguration().setProxy(proxyHost,proxyPort); 
+         
+  GetMethod get = new GetMethod(url);
+  get.setFollowRedirects(true);
+  String strGetResponseBody = null;
+         
+  try {
+      int iGetResultCode = client.executeMethod(get);
+      strGetResponseBody = get.getResponseBodyAsString();
+  } catch (Exception ex) {
+      ex.printStackTrace();
+  } finally {
+      get.releaseConnection();
+  }
+ 
+ }}}
+ 
+ 
  === Further Reading ===
  
  [http://java.sun.com/j2ee/1.4/docs/tutorial/doc/Overview6.html The J2EE 1.4 
Tutorial, Security] (SUN)

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to