The team I'm working on has written a custom implementation of the 
ProxySelector class to dynamically handle proxying for all of our outbound 
connections.
The custom ProxySelector still falls back to the default one, which will use 
the proxy system properties if they are set.

I noticed in our CXF client that if the proxy system properties are set, the 
custom ProxySelector never gets called, even if the HTTPClientPolicy on the 
client is left unchanged.

After looking at the CXF code, it appears that the reason this happens is 
because org.apache.cxf.transport.http.ProxyFactory creates a Proxy object based 
on the system properties if there is not proxy configuration in the 
HTTPClientPolicy. That Proxy object eventually get passed as an argument to 
url.openConnection(), overriding our ProxySelector.

I've been wrong before, but this doesn't seem to be intuitive behavior.  I 
would expect that if the HTTPClientPolicy had not been configured with proxy 
settings that CXF would call the "no-arg" version of url.openConnection, 
regardless of whether or not the system properties are set.  In this case, if 
the system properties are set, and no customizations have been made to the 
ProxySelector the default ProxySelector would still use the system properties.

Am I off base here?

Jonathan




This transmission may contain information that is privileged,
confidential, legally privileged, and/or exempt from disclosure
under applicable law.  If you are not the intended recipient, you
are hereby notified that any disclosure, copying, distribution, or
use of the information contained herein (including any reliance
thereon) is STRICTLY PROHIBITED.  Although this transmission and
any attachments are believed to be free of any virus or other
defect that might affect any computer system into which it is
received and opened, it is the responsibility of the recipient to
ensure that it is virus free and no responsibility is accepted by
JPMorgan Chase & Co., its subsidiaries and affiliates, as
applicable, for any loss or damage arising in any way from its use.
 If you received this transmission in error, please immediately
contact the sender and destroy the material in its entirety,
whether in electronic or hard copy format. Thank you.

Reply via email to