cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Ross <...@missioncriticalit.com>
Subject "host is null" bugfix for WebServiceProxyGenerator
Date Thu, 03 Jul 2003 14:47:52 GMT
On Wed, Jul 02, 2003 at 11:36:25AM -0500, Tony Collen wrote:
> See this thread in the message archive, it is a known problem and I'm 
> working on tracking down the problem.
> 
> http://marc.theaimsgroup.com/?t=105707418000006&r=1&w=2
> 
The following patch works for me, but note that there is still an
unresolved problem with the fact that we don't parse http.nonProxyHosts
to ensure that proxying is only enabled for connections which need it.

Index: src/java/org/apache/cocoon/generation/WebServiceProxyGenerator.java
===================================================================
RCS file: /home/cvspublic/cocoon-2.1/src/java/org/apache/cocoon/generation/WebServiceProxyGenerator.java,v
retrieving revision 1.3
diff -u -r1.3 WebServiceProxyGenerator.java
--- src/java/org/apache/cocoon/generation/WebServiceProxyGenerator.java	16 Mar 2003 17:49:15
-0000	1.3
+++ src/java/org/apache/cocoon/generation/WebServiceProxyGenerator.java	3 Jul 2003 14:42:31
-0000
@@ -286,7 +286,7 @@
  * consequetively return an HttpMultiClient
  *
  */
-protected HttpClient getHttpClient()
+protected HttpClient getHttpClient() throws ProcessingException
 {
   Request request = ObjectModelHelper.getRequest( objectModel );
   Session session = request.getSession( true );
@@ -298,18 +298,30 @@
   if (httpClient == null)
   {
     httpClient = new HttpClient();
-    
+
+    HostConfiguration config = httpClient.getHostConfiguration();
+    if (config == null) {
+      config = new HostConfiguration();
+    }
+
+    try {
+    	config.setHost(new org.apache.commons.httpclient.URI(this.source));
+    }
+    catch (Exception ex) {
+    	throw new ProcessingException("URI format error: " + ex, ex);
+    }
+
+    // XXX we don't check http.nonProxyHosts to see whether or not the proxy
+    // server should be used, this functionallity really should be part of 
+    // httpClient.
     if (System.getProperty("http.proxyHost") != null)
     {
       String proxyHost = System.getProperty("http.proxyHost");
       int proxyPort = Integer.parseInt(System.getProperty("http.proxyPort"));
-      HostConfiguration config = httpClient.getHostConfiguration();
-      if (config == null) {
-        config = new HostConfiguration();
-      }
       config.setProxy(proxyHost, proxyPort);
-      httpClient.setHostConfiguration(config);
     }
+
+    httpClient.setHostConfiguration(config);
     
     session.setAttribute( HTTP_CLIENT, httpClient );
   }

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message