cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Kulp <dk...@apache.org>
Subject Re: CXF and HTTP proxy properties
Date Wed, 13 Oct 2010 21:21:49 GMT
On Wednesday 13 October 2010 9:34:27 am Guillaume Sauthier wrote:
> Hi team
> 
> I've found plenty of examples over the internet explaining how to setup
> an HTTP proxy (using Spring or the API).
> This is always done on a per-service basis.
> I was wondering why the http.proxy* System properties were not used for
> supporting this ?

This is: https://issues.apache.org/jira/browse/CXF-2839


> In my use case (the JOnAS application server), I have fileds annotated
> with @WebServiceRef (plus some standard XML descriptors). The job of the 
Configuration here, remember the Java EE saint
> graal of portability between different providers), but I found that I
> may be blindly configuring a port to use the system proxy without
> knowing if the real endpoint address required a proxy or not.
> For example, imagine an enviro
> AS is to prepare the instances (port or services) that will be injected
> into theses fields. I was thinking that I could configure the CXF Client
> object in this phase.
> 
> I was hoping that I could take the proxy System properties, extract
> required values from them and apply them on an HTTPClientPolicy for the
> HTTPConduit (no Spring Configuration here, remember the Java EE saint
> graal of portability between different providers), but I found that I
> may be blindly configuring a port to use the system proxy without
> knowing if the real endpoint address required a proxy or not.
> For example, imagine an environment were system proxy is required and
> configured to access external world, but the user wants to use a WS on
> localhost: if I configure it to use the proxy, it will fail during the
> call.
> 
> I thought to use the nonProxyHost system property to conditionally apply
> the proxy config but my use case required me to apply the config at the
> very last moment (when we know the exact endpoint URL), requiring me to
> wrap and proxy a lot of CXF classes. Definitely not an ideal solution :)
> Or maybe I could implement this directly inside CXF...
> 
> So, I come here to discuss this point.
> Could it be possible (currently I'm not sure, but maybe as an evolution)
> to provide the proxy configuration as some kind of global variable for
> all the services (maybe as a per-bus configuration), but with support
> for nonProxyHost (or the like) ?
> 
> WDYT ?

I think this could be done via an interceptor as well.   An interceptor run 
very early in the chain could grab the conduit and reconfigure the proxy stuff 
fairly easily based on the URL it's going to hit. 

The other way to handle this, which is how JBoss does this I believe, is to 
set their own Configurer on the bus that wrappers the original one and has 
configureBean methods that, if the bean is an HTTPConduit, completely 
configures the conduit based on information from the app servers configs.   
Really, that is the ideal way for app servers and containers and such to 
configure the various parts of CXF as CXF uses that mechanism to configure 
itself.


-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog

Mime
View raw message