cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Benson Margulies <bimargul...@gmail.com>
Subject Re: Getting around HttpUrlConnection restrictions
Date Thu, 01 Dec 2011 15:47:05 GMT
On Thu, Dec 1, 2011 at 10:34 AM, Daniel Kulp <dkulp@apache.org> wrote:
> On Thursday, December 01, 2011 9:46:41 AM Benson Margulies wrote:
>> There is a system property that disables it -- read once -- in a static
>> block.
>>
>> Does anyone thing it would be possible to create an independent class
>> loader and load this class into it a second time, with the property
>> set, and then talk to it via reflection?
>
> Wouldn't it be easier to just use a little reflection to grab the set and call
> remove on it:

That hasn't occurred to me.

>
> Class cls = Class.forName("sun.net.www.protocol.http.HttpURLConnection");
> Field f = cls.getDeclaredField("restrictedHeaderSet");
> f.setAssible(true);
> ((Set)f.get(null)).remove("origin");
>
>
> Now, that will likely not work in OSGi as the Class.forName is likely to
> completely fail.   Would need to figure something else out there.  Probably
> would have to allow the system to export that package.
>
>
> --
> Daniel Kulp
> dkulp@apache.org - http://dankulp.com/blog
> Talend Community Coder - http://coders.talend.com

Mime
View raw message