On Thu, Dec 1, 2011 at 10:34 AM, Daniel Kulp <[email protected]> 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
> [email protected] - http://dankulp.com/blog
> Talend Community Coder - http://coders.talend.com