cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Kulp <dk...@apache.org>
Subject Re: Getting around HttpUrlConnection restrictions
Date Thu, 01 Dec 2011 15:34:53 GMT
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:

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