Reputation: 39415
I would like to create a REST interface for my Java Google App Engine program. I figured I would start by generating some XML from my POJOS. However, it seems that XStream is bitten by GAE's restrictions.
What can I use to generate an XML string in Google App Engine?
Thanks.
Edit 1: Here is the beginning of the exception:
javax.servlet.ServletContext log: Exception while dispatching incoming RPC call
com.google.gwt.user.server.rpc.UnexpectedException: Service method 'public abstract java.lang.String com.mydomain.client.ObjectService.sendObject(com.mydomain.client.models.myobject)' threw an unexpected exception: java.security.AccessControlException: access denied (java.io.SerializablePermission enableSubclassImplementation)
Upvotes: 2
Views: 1353
Reputation: 11550
Try Jersey - it will give you XML, JSON, and lots more via REST; all using annotated methods.
It works for me, however there are some caveats:
Upvotes: 1
Reputation: 403551
The exception is caused by a java.io.SerializablePermission, which according the javadoc is for allowing:
Subclass implementation of ObjectOutputStream or ObjectInputStream to override the default serialization or deserialization, respectively, of objects
XStream might be using Object streams under the covers, and falling foul of this permission not being granted.
Does Google App Engine actually have a whitelist, or just a set of restricted permissions? JAXB2 doesn't use Object streams, so have you actually tried that?
Upvotes: 1
Reputation: 116372
For the same restriction (a patch is underway however) I ended producing JSON using org.json library. Also JAXB seems not to be in the whitelist.
Upvotes: 1