Reflection Permission problems when using the GSON library in a applet.

Posted by mridang on Stack Overflow See other posts from Stack Overflow or by mridang
Published on 2010-05-07T11:06:53Z Indexed on 2010/05/07 11:28 UTC
Read the original article Hit count: 484

Filed under:
|
|
|
|

I'm writing an Applet that makes some JSON-RPC calls. I'm using the Google JSON library (GSON) to cast the response JSON into a class. Thsi seems to work fine as is but when I use this code in my Applet, I'm hit with a java.lang.reflect.reflectpermission. From what I read on this thread on SO, it seems that since GSON uses Reflection, I cannot use it in Applets unless I explicitly modify the security policy. How can I get around this? I've created a bunch of classes in my application and was using the Gson.fromJson method to cast it into the class. Is there any way to achieve the same functionality without having to re-write half my code.

(The complexity of dealing with JSON in Java seems to be in a league of its own!)

Thanks in advance guys.

© Stack Overflow or respective owner

Related posts about java

Related posts about gson