-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Dan,
actually, the patch wasn't quite complete. I forgot to include the
option that users can override the system settings for http.nonProxyHost
just as they can do it with http.proxyHost and http.proxyPort.
With the patch I attached to this mail, the following is possible:
Client cl = ...; // get your XFire client
cl.setProperty( CommonsHttpMessageSender.HTTP_PROXY_HOST,
"proxy.company.com" );
cl.setProperty( CommonsHttpMessageSender.HTTP_PROXY_PORT,
"8080");
cl.setProperty( CommonsHttpMessageSender.HTTP_NON_PROXY_HOSTS,
"*.dep1.company.com|*.dep2.company.com|localhost" );
Cheers,
Michel
Dan Diephouse wrote:
> Hi Michel,
> Thanks for the heads up. I've reopened the issue and scheduled it for
> 1.2.3. Will work on getting this integrated soon!
> Cheers,
> - Dan
>
> Michel Drescher wrote:
> Dan,
>
> the said XFire issue is actually still bogus as XFire ignores the
> standard Java system property "http.nonProxyHosts" as per
> http://java.sun.com/j2se/1.5.0/docs/guide/net/properties.html.
>
> Description:
> XFire recognises the system properties "http.proxyHost" and
> "http.proxyPort" but ignores "http.nonProxyHosts". In certain network
> conditions, this has the effect that internal servers cannot be
> contacted unless the (computer-)global proxy settings are set to direct
> connections. This current behaviour practically either disables external
> communications (with enabled internal communication) or internal
> communications (with enabled external communication).
>
> XFire version: 1.2.2
> Affected class:
> org.codehaus.xfire.transport.http.CommonsHttpMessageSender
> Affected method: private synchronized void createClient()
>
> The attached patch shows the differences between my local copy and the
> official source of class
> org.codehaus.xfire.transport.http.CommonsHttpMessageSender in version
> 1.2.2.
> [Local restrictions stop me from "diff"ing against the live SVN
> repository]
>
> Cheers,
> Michel
>
- ------------------------------------------------------------------------
>>
7,11d6
< import java.net.Proxy;
< import java.net.ProxySelector;
< import java.net.URI;
< import java.net.URISyntaxException;
< import java.util.List;
68d62
< public static final String HTTP_NON_PROXY_HOSTS =
"http.nonProxyHosts";
201,205d194
< String uri = context.getOutMessage().getUri();
< if ( isNonProxyHost(uri, context ) ) {
< // this host does not need a proxy
< return;
< }
227,250d215
< < private boolean isNonProxyHost( String strURI, MessageContext
context ) {
< // convert String based URI into a URI class based URI ...
< URI uri = null;
< try {
< uri = new URI( strURI );
< }
< catch (URISyntaxException use) {
< // this should actually not happen, but just in case.
< return false;
< }
< // ... get a system platform ProxySelector, and ...
< ProxySelector ps = ProxySelector.getDefault();
< // ... let this selector return a list of proxies.
< List<Proxy> proxies = ps.select( uri );
< // If that lists sole element is of type Proxy.NO_PROXY
< // then we need a direct connection, otherwise we need to
connect
< // through a proxy.
< if ( proxies.size() == 1 && <
proxies.get(0).equals(Proxy.NO_PROXY ) ) {
< return true;
< }
< return false;
< }
- ------------------------------------------------------------------------
>>
- ---------------------------------------------------------------------
To unsubscribe from this list please visit:
>>
http://xircles.codehaus.org/manage_email
- --
Michel <dot> Drescher <at> uk <dot> fujitsu <dot> com
Fujitsu Laboratories of Europe
+44 20 8606 4834
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFFNfCmk0lMZTNKw4QRAiSZAKCi1Kyx7rLf1BXdp6UB7HRNRZrmZgCfT3wU
g7oWZ98wMQ7oNWobpmK1Q7c=
=kT9P
-----END PGP SIGNATURE-----
7,11d6
< import java.net.Proxy;
< import java.net.ProxySelector;
< import java.net.URI;
< import java.net.URISyntaxException;
< import java.util.List;
68d62
< public static final String HTTP_NON_PROXY_HOSTS = "http.nonProxyHosts";
201,218d194
< // first make sure that the system property http.nonProxyHost
is set
< // so that the ProxySelector can do its job
< String nonProxyHosts = (String)
context.getContextualProperty(HTTP_NON_PROXY_HOSTS);
< if (nonProxyHosts != null)
< {
< // only if the context is not null use it to override the
system property http.nonProxyHosts
< try {
< System.setProperty( HTTP_NON_PROXY_HOSTS,
nonProxyHosts);
< }
< catch (SecurityException se) {
< // we are not allowed to do that, so we keep relying on
the current system configuration
< }
< }
< String uri = context.getOutMessage().getUri();
< if ( isNonProxyHost(uri ) ) {
< // this host does not need a proxy
< return;
< }
241,266d216
< private boolean isNonProxyHost( String strURI ) {
< // convert String based URI into a URI class based URI ...
< URI uri = null;
< try {
< uri = new URI( strURI );
< }
< catch (URISyntaxException use) {
< // this should actually not happen, but just in case.
< return false;
< }
< // ... get a system platform ProxySelector, and ...
< ProxySelector ps = ProxySelector.getDefault();
< // ... let this selector return a list of proxies.
< List<Proxy> proxies = ps.select( uri );
<
<
< // If that lists sole element is of type Proxy.NO_PROXY
< // then we need a direct connection, otherwise we need to connect
< // through a proxy.
< if ( proxies.size() == 1 &&
< proxies.get(0).equals(Proxy.NO_PROXY ) ) {
< return true;
< }
< return false;
< }
<
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email