You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Peter Ross <pr...@missioncriticalit.com> on 2003/07/03 16:47:52 UTC

"host is null" bugfix for WebServiceProxyGenerator

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


Re: "host is null" bugfix for WebServiceProxyGenerator

Posted by Geoff Howard <co...@leverageweb.com>.
Peter Ross wrote:

>On Thu, Jul 03, 2003 at 11:39:15AM -0500, Tony Collen wrote:
>  
>
>>Pete, would you mind submitting this as a patch?  Perhaps we can slip this 
>>in before 2.1 goes final.
>>
>>    
>>
>How do I submit it as a patch?
>
Follow the link to bugzilla from the cocoon.apache.org site and file it 
as a "bug" with the summary
starting with [PATCH].

Thanks,
Geoff


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


Re: "host is null" bugfix for WebServiceProxyGenerator

Posted by Peter Ross <pr...@missioncriticalit.com>.
On Thu, Jul 03, 2003 at 11:39:15AM -0500, Tony Collen wrote:
> Pete, would you mind submitting this as a patch?  Perhaps we can slip this 
> in before 2.1 goes final.
> 
How do I submit it as a patch?

I am also working on handling http.nonProxyHosts at least semi-correctly
as I need to access web-services both inside and outside the firewall at
my work.

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


Re: "host is null" bugfix for WebServiceProxyGenerator

Posted by Tony Collen <co...@umn.edu>.
Peter Ross wrote:
> 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.


Well, looks like you're ahead of me.. this look good.. can anyone else confirm this works (like 
anyone else who was posting to the list about the WSPG) ?

Pete, would you mind submitting this as a patch?  Perhaps we can slip this in before 2.1 goes final.


Tony


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